![]() |
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 |
All times are GMT. The time now is 15:22. |
vBulletin® Version 3.8.8