Spinbox detect pressed
Solved
QML and Qt Quick
-
-
@mark.lt
oh i've overseen that this thread is in the QML forum.The SpinBox type does have a corresponding property?!
-
This post is deleted!
-
Hi @mark.lt,
You can work around this pretty easily by creating your own SpinBox component, using
down
andup
properties as suggested by @raven-worx ://MySpinBox.qml import QtQuick 2.9 import QtQuick.Controls 2.2 SpinBox{ signal decreased(int value) signal increased(int value) down.onPressedChanged: { if(down.pressed){ console.log("Decreased") decreased(value) } } up.onPressedChanged: { if(up.pressed){ console.log("Increased") increased(value) } } }
Usage
MySpinBox{ onIncreased: //Value increased onDecreased: //Value decreased }
-
@raven-worx Yeah, I saw that property but my problem was that I needed a signal that tells me when it changes.
Then I resolved it by creating a property binded to up.pressed or down.pressed then I used the on___Changed then I checked if it is true.
property bool upPressed: up.pressed onUpPressedChanged: { if (up.pressed){ //so something } }
@Gojir4 Thanks :D