I hava a QML button, and I want to prevent the button to be clicked before my function call is finished.
I tried the code below and it's not working. Button does not toggle enabled/disabled within the clicked
signal. I guess the binding does not take effect immediately.
import QtQuick
import QtQuick.Control
Button {
onClicked: {
console.log('clicked')
this.enabled = false
do_something()
this.enabled = true
}
}
I also tried pressed
signal
Button {
onPressed: {
console.log('pressed')
this.enabled = false
}
onClicked: {
console.log('clicked')
do_something()
this.enabled = true
}
}
But the onClicked
signal is not triggered at all.