Skip to content

Instantly share code, notes, and snippets.

@zymtx5g79k
Last active January 25, 2016 15:55
Show Gist options
  • Save zymtx5g79k/7190e7bb7dbb26e66be2 to your computer and use it in GitHub Desktop.
Save zymtx5g79k/7190e7bb7dbb26e66be2 to your computer and use it in GitHub Desktop.
color: Qt.rgba(Qt.random(), Qt.random(), Qt.random(), 1)
Button {
id: button
signal pressAndHold()
Timer {
id: longPressTimer
interval: 2000 //your press-and-hold interval here
repeat: false
running: false
onTriggered: {
button.pressAndHold()
}
}
onPressedChanged: {
if ( pressed ) {
longPressTimer.running = true;
} else {
longPressTimer.running = false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment