| The Following 2 Users Say Thank You to Markkyboy For This Useful Post: | ||
|
|
2019-08-18
, 11:34
|
|
Posts: 479 |
Thanked: 1,284 times |
Joined on Jan 2012
@ Enschede, The Netherlands
|
#2
|
| The Following 4 Users Say Thank You to Fuzzillogic For This Useful Post: | ||
|
|
2019-08-18
, 12:16
|
|
|
Posts: 433 |
Thanked: 727 times |
Joined on Oct 2012
@ Costa Blanca, Espaņa
|
#3
|
| The Following 2 Users Say Thank You to Markkyboy For This Useful Post: | ||
|
|
2019-08-18
, 13:05
|
|
Posts: 479 |
Thanked: 1,284 times |
Joined on Jan 2012
@ Enschede, The Netherlands
|
#4
|
Rectangle {
width: 100; height: 100
color: "green"
Timer {
interval: 200
repeat: true
id: timer
onTriggered: counter.text = counter.count++
}
MouseArea {
anchors.fill: parent
onPressed: timer.start()
onReleased: timer.stop()
}
}
Timer {
interval: 200
repeat: true
running: area.pressed
onTriggered: counter.text = counter.count++
}
MouseArea {
anchors.fill: parent
id: area
}
|
|
2019-08-18
, 16:32
|
|
|
Posts: 433 |
Thanked: 727 times |
Joined on Oct 2012
@ Costa Blanca, Espaņa
|
#5
|

// First row of 10, consists of rectangle, mouse and label
Row { id: row; anchors.horizontalCenter: parent.horizontalCenter; spacing: 45
Rectangle { id: brightUp; width: 80; height: 80; radius: 40; color: "white"
MouseArea {
id: mouse
anchors.fill: brightUp
onClicked: {
getData()
function getData(url) {
var xhttp = new XMLHttpRequest()
xhttp.onreadystatechange = function(myxhttp) {
if (xhttp.readyState == 4 && xhttp.status == 200) {
led.opacity = 1.0
timer.start()
}
return function() {
if(myxhttp.readyState === 4) callback(myxhttp)
}
}
xhttp.open("GET", "http://192.168.4.1/ir?code=16726725")
xhttp.send('')
}
}
// Stop/start the repeater
onPressed: {
console.log("Repeat triggered")
pressTimer.start()
}
// This timer is purely to time the flashing of a virtual LED on my app's UI
Timer {
id: timer
interval: 50
repeat: true
running: false
onTriggered: {
led.opacity = 0.0
}
} // This timer is for repeating a held mouse click
Timer {
id: pressTimer
interval: 200
running: mouse.pressed
repeat: true
onTriggered: {
timer.start()
mouse.clicked(mouse)
console.log("Repeat started")
}
}
// Other stuff . . .

| The Following 4 Users Say Thank You to Markkyboy For This Useful Post: | ||
I've struggled to find any hints on how to do this, so I ask here.
I have made a remote control app to control my LED RGBW lighting strips. The remote app has 40 buttons. 4 of these 40 buttons could do with being repeatable, so I can either single click or hold for multiple clicks. NOTE: I'm not actually using buttons, but instead, I'm using rectangles with a mouse area.
I would then use this for say, controlling brightness of my RGBW strip, just holding "Bright +" will go all the way and vice-versa.
How to achieve this please?
Thanks,
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
Last edited by Markkyboy; 2019-08-18 at 12:17.