KnobControl: fix changing value by using the mouse wheel
Workaround for QML bug
This commit is contained in:
parent
19bc67beee
commit
f7f35a34aa
1 changed files with 9 additions and 0 deletions
|
@ -165,6 +165,7 @@ Dial {
|
|||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
onDoubleClicked: {
|
||||
root.newValueRequested(0)
|
||||
|
@ -197,5 +198,13 @@ Dial {
|
|||
let bounded = Math.max(root.from, Math.min(newValue, root.to))
|
||||
root.newValueRequested(bounded)
|
||||
}
|
||||
|
||||
// We also listen for wheel events here, but for a different reason:
|
||||
// Qml Dial has a bug that it doesn't emit moved() when the value is changed through a wheel event.
|
||||
// So when we see a wheel event, we let the dial handle it, but we will account for emitting the signal.
|
||||
onWheel: function(wheel) {
|
||||
wheel.accepted = false
|
||||
Qt.callLater(function() { root.newValueRequested(Math.round(value)) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue