![]() |
Re: Help me to code for Sailfish OS
cool! [16 chars]
|
Re: Help me to code for Sailfish OS
The following code is a part of a Row, the Rectangle acts as a button and sends an IR command via WiFi to a Tasmotised Sonoff RF;
Code:
Light ON = GREEN (mainLights1.border.color) - DONE Light OFF = YELLOW (mainLights1.border.color) - ???? I've tried so many things, too many to list. Perhaps using 'if/else' is not the way to go? |
Re: Help me to code for Sailfish OS
i'm not sure what are you doing here, but probably you need to check result of network call, or perform additional call to get actual state of lights, and change color of button
|
Re: Help me to code for Sailfish OS
Well, it's a button made from a rectangle, when the button is pressed it turns a light on. When the light is on, the button should be green, when the light is turned off, the button should be yellow.
Sounds like you do understand my question, but how do I check the result of the network call? In the code, there is console.log(), this outputs the xhttp.responseText, for example, the response looks like this; Code:
mainLights1 "{"POWER":"ON"}" |
Re: Help me to code for Sailfish OS
Code:
mainLights1.border.color = JSON.parse(xhttp.responseText).POWER == 'ON' ? "green" : "red" |
Re: Help me to code for Sailfish OS
Quote:
|
Re: Help me to code for Sailfish OS
coderus, I read something about a FileModel. The post referred to your GitHub page, but the files have been removed from there. Is it possible to view them somewhere else?
|
Re: Help me to code for Sailfish OS
Quote:
|
Re: Help me to code for Sailfish OS
Sure. For my app (pure QML/JS now) I would like to have the possibility to select a file in Downloads, and the content into a variable.
|
Re: Help me to code for Sailfish OS
Quote:
you can select file in QML, but you can't read it using qml only. You need Qt or python backend |
Arranging numbers/letters/tickmarks in a circle
1 Attachment(s)
My application shows a dial with compass bearings (numbers) and tickmarks (asterisks).
I cannot use QML CircularGauge for my purpose because 'Controls.Styles' is not available in SFOS. Currently, I am using this method for placing my text/numbers in a circular fashion; Code:
Rectangle { thanks, |
Re: Help me to code for Sailfish OS
found this https://github.com/RSATom/Qt/blob/ma...GaugeStyle.qml
i think its easy to copy and implement as standalone item |
Re: Help me to code for Sailfish OS
Quote:
/* I'll play anyway, its a huge file for what it does, amazing.*/ EDIT, I decided against playing with this file, it requires 4 import modules that are not available in SFOS. thanks, |
Re: Help me to code for Sailfish OS
Grab minimal code, then go to styles if you really need it. For bare minimal code inside CircularGaugeStyle is enough to be copied to standalone item
|
Re: Help me to code for Sailfish OS
Quote:
|
Re: Help me to code for Sailfish OS
you can't just copy and paste, you have to code the code! you can take idea from existing qtquick item and adapt to your project.
|
Re: Help me to code for Sailfish OS
Is this anyway related even though there is no ready answer?
https://talk.maemo.org/showthread.php?t=96839 |
Re: Help me to code for Sailfish OS
Quote:
|
Re: Help me to code for Sailfish OS
Would rinigus know answer to this? It seems he has done some stuff which may include something related.
|
Re: Help me to code for Sailfish OS
Quote:
- There is a page with a ListView, with a model from database contents - Tapping on an item opens a new Dialog, where the database item could change - popping the dialog leaves an old listview that needs refreshing Now, I found your GitHub page on callbacks: https://gist.github.com/CODeRUS/5235...bfaf0bafbeb7cd Could I push the dialog with a callback to a function that would update the listview? Or is that not what the callback is for? Something like: pageStack.push(Qt.resolvedUrl("DialogPage.qml"), {callback: updateListViewAfterDialog }) Update: yes, this seems to work! |
Re: Help me to code for Sailfish OS
Codearus, maybe you know some way to manipulate the virtual keyboard from QML.
I noticed OKboard stops functioning frequently. The cause of it, I think, is my app GMFS. it seems every time I use a Dialog with numerical input, like Code:
inputMethodHints: Qt.ImhFormattedNumbersOnly Do you know a command I can use in my app - QML/JS - to revive OKboard? |
Re: Help me to code for Sailfish OS
Quote:
|
Re: Help me to code for Sailfish OS
Currently, I have Eclipse MQTT 1.3.1 running flawlessly on my Jolla1.
I note there are 3 files for MQTT on my device, found in /usr/bin/; mosquitto_passwd, mosquitto_sub and mosquitto_pub I also have a remote control app (as previously discussed with regard to changing button colours when lights are on/off). I would like to utilise MQTT to tell my Jolla1 when a light switch has been activated and change/update the button colour accordingly. I am quite conversant with MQTT commands, but totally lack any ideas on how to implement/include MQTT in my remote control application. Side note: MQTT for QML is not part of Qt, it is QtAutomotive, which requires licensing, so no good using official routes. Any input appreciated, thanks |
Re: Help me to code for Sailfish OS
you can't implement it with given cli tools
|
Re: Help me to code for Sailfish OS
Hi coderus,
I have a small niggle with fetching an image from openweathermap.org. See the following code; HTML Code:
Image { Yields the following error; [W] unknown:13 - file:///usr/share/my-weather-landscape/qml/pages/WeatherIcon.qml:13:5: QML Image: Error transferring http://openweathermap.org/img/wn/@2x.png - server replied: Not Found but the required/expected image is returned and displayed. How can I prevent this error?, is there a better way to retrieve the required image? Thanks, |
Re: Help me to code for Sailfish OS
do not load image if label text is empty?
|
Re: Help me to code for Sailfish OS
Quote:
However, instead I added a Timer with no interval to be triggered upon the feed being updated or the app being started, the image is loaded successfully and I do not see any error in console log (thumbs up!) I'm still open to any suggestions (preferably with an example) if someone knows a better way. |
Re: Help me to code for Sailfish OS
try adding
Code:
enabled: label.text |
Re: Help me to code for Sailfish OS
Quote:
|
Re: Help me to code for Sailfish OS
Quick question for anyone - how can I see all dconf keys? I can use dconf list command, but it seems like it doesn't show everything, since I am able to change certain values with write command that I don't see listed...
(sorry I can't remember the specifics atm - it's something I've been meaning to get around to posting for a while now, after messing around with it months ago - maybe someone knows about it... I'll try to pull it back up at some point and refresh my memory...) |
Re: Help me to code for Sailfish OS
You mean like ?
Code:
dconf dump / |
Re: Help me to code for Sailfish OS
as per the response from peterleinchen, you can also output to file;
Code:
dconf dump / > dconf-output.txt |
Re: Help me to code for Sailfish OS
What's the proper way to store an apps settings?
For my current (and first) app I'm for now just grabbing the `$HOME` environment variable and stuff a file in `$HOME/.config/app/settings`, but this is just for local dev and testing. Once I'm distributing it through OpenRepos I'd like to do it the proper way (if there is one). edit: Thanks for the hint, coderus. I've gone with: Code:
QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) |
Re: Help me to code for Sailfish OS
Quote:
Code:
QStandardPaths::writableLocation(QStandardPaths::DataLocation) |
All times are GMT. The time now is 15:19. |
vBulletin® Version 3.8.8