mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 06:08:48 +03:00
Simplify logic to suppress wheel events
This commit is contained in:
parent
af8fbb990b
commit
d941974e35
1 changed files with 6 additions and 14 deletions
|
@ -31,17 +31,6 @@ Rectangle {
|
||||||
|
|
||||||
contentWidth: availableWidth
|
contentWidth: availableWidth
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: deadTimer
|
|
||||||
interval: 500
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: scroll.contentItem
|
|
||||||
function onContentYChanged() { deadTimer.restart(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: grid
|
id: grid
|
||||||
|
|
||||||
|
@ -111,8 +100,9 @@ Rectangle {
|
||||||
width: Math.min(parent.width, implicitWidth)
|
width: Math.min(parent.width, implicitWidth)
|
||||||
model: r.model.values
|
model: r.model.values
|
||||||
currentIndex: r.model.value
|
currentIndex: r.model.value
|
||||||
enabled: !deadTimer.running
|
|
||||||
onCurrentIndexChanged: r.model.value = currentIndex
|
onCurrentIndexChanged: r.model.value = currentIndex
|
||||||
|
|
||||||
|
WheelHandler{} // suppress scrolling changing values
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
|
@ -121,13 +111,14 @@ Rectangle {
|
||||||
SpinBox {
|
SpinBox {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
width: Math.min(parent.width, implicitWidth)
|
width: Math.min(parent.width, implicitWidth)
|
||||||
enabled: !deadTimer.running && model.enabled
|
|
||||||
from: model.valueLowerBound
|
from: model.valueLowerBound
|
||||||
to: model.valueUpperBound
|
to: model.valueUpperBound
|
||||||
stepSize: model.valueStep
|
stepSize: model.valueStep
|
||||||
value: model.value
|
value: model.value
|
||||||
onValueChanged: model.value = value
|
onValueChanged: model.value = value
|
||||||
editable: true
|
editable: true
|
||||||
|
|
||||||
|
WheelHandler{} // suppress scrolling changing values
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
|
@ -141,7 +132,6 @@ Rectangle {
|
||||||
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
width: Math.min(parent.width, implicitWidth)
|
width: Math.min(parent.width, implicitWidth)
|
||||||
enabled: !deadTimer.running && model.enabled
|
|
||||||
from: model.valueLowerBound * div
|
from: model.valueLowerBound * div
|
||||||
to: model.valueUpperBound * div
|
to: model.valueUpperBound * div
|
||||||
stepSize: model.valueStep * div
|
stepSize: model.valueStep * div
|
||||||
|
@ -163,6 +153,8 @@ Rectangle {
|
||||||
valueFromText: function(text, locale) {
|
valueFromText: function(text, locale) {
|
||||||
return Number.fromLocaleString(locale, text) * spinbox.div
|
return Number.fromLocaleString(locale, text) * spinbox.div
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WheelHandler{} // suppress scrolling changing values
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
|
|
Loading…
Reference in a new issue