![]() |
2020-01-11
, 09:41
|
Posts: 34 |
Thanked: 30 times |
Joined on Nov 2011
|
#71
|
![]() |
2020-01-11
, 09:46
|
|
Posts: 6,436 |
Thanked: 12,701 times |
Joined on Nov 2011
@ Ängelholm, Sweden
|
#72
|
![]() |
2020-01-11
, 09:48
|
Posts: 34 |
Thanked: 30 times |
Joined on Nov 2011
|
#73
|
Timer { id: ambiencetimer interval: 1 onTriggered: {applyAmbienceThemeColors();} }
![]() |
2020-03-16
, 11:53
|
|
Posts: 433 |
Thanked: 727 times |
Joined on Oct 2012
@ Costa Blanca, España
|
#74
|
Row { id: row1; ........ Rectangle { id: brightUp; width: 60; height: 60; radius: 30 ....... MouseArea { anchors.fill: brightUp onClicked: { var xmlhttp = new XMLHttpRequest() xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState === 4 && xmlhttp.status === 200) { console.log("Brightness UP") } } xmlhttp.open("POST", "http://192.168.0.222/lightup") xmlhttp.send() } }
The Following User Says Thank You to Markkyboy For This Useful Post: | ||
![]() |
2020-03-16
, 12:44
|
|
Posts: 878 |
Thanked: 2,535 times |
Joined on Feb 2012
@ Germany
|
#75
|
I was thinking that a matrix of all 40 codes could be listed on the second page, but how would this look?, how do I call each code when a button is clicked on my first page?
![]() |
2020-03-16
, 20:51
|
|
Posts: 6,436 |
Thanked: 12,701 times |
Joined on Nov 2011
@ Ängelholm, Sweden
|
#76
|
function controlLamp(endpoint) { var xmlhttp = new XMLHttpRequest() xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState === 4 && xmlhttp.status === 200) { console.log(endpoint) } } xmlhttp.open("POST", "http://192.168.0.222/" + endpoint) xmlhttp.send() }
MouseArea { anchors.fill: brightUp onClicked: { controlLamp("lightup") } }
The Following 5 Users Say Thank You to coderus For This Useful Post: | ||
![]() |
2020-03-17
, 00:41
|
|
Posts: 433 |
Thanked: 727 times |
Joined on Oct 2012
@ Costa Blanca, España
|
#77
|
inside main.qml declare:
and call anywhere you want like:Code:function controlLamp(endpoint) { var xmlhttp = new XMLHttpRequest() xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState === 4 && xmlhttp.status === 200) { console.log(endpoint) } } xmlhttp.open("POST", "http://192.168.0.222/" + endpoint) xmlhttp.send() }
Code:MouseArea { anchors.fill: brightUp onClicked: { controlLamp("lightup") } }
The Following User Says Thank You to Markkyboy For This Useful Post: | ||
![]() |
2020-04-12
, 09:58
|
Posts: 5 |
Thanked: 5 times |
Joined on Apr 2020
@ Biskupová, Slovakia
|
#78
|
The Following User Says Thank You to Morc For This Useful Post: | ||
![]() |
2020-04-12
, 10:39
|
Posts: 479 |
Thanked: 1,284 times |
Joined on Jan 2012
@ Enschede, The Netherlands
|
#79
|
Hi, I've been thinking of adding auto refresh interval to my app and also to add settings for that auto refresh and also for other things. Are there any simple code examples for C++ or JavaScript?
![]() |
2020-04-12
, 11:58
|
Posts: 5 |
Thanked: 5 times |
Joined on Apr 2020
@ Biskupová, Slovakia
|
#80
|
Guess we'd need a bit more than that. What language(s) is the app? QML has the Timer object, of which you can see an example earlier on this very page.
To store settings, SailishOS has the Configuration API for QML. I must say the documentation isn't very clear and lacking of any examples...
The Following User Says Thank You to Morc For This Useful Post: | ||