48 lines
1.1 KiB
QML
48 lines
1.1 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
|
|
Item {
|
|
id: self
|
|
width: parent.width/parent.childcount
|
|
property var editMode: false
|
|
property var from:0
|
|
property var to:0
|
|
property var text: ""
|
|
property var value: ""
|
|
height: 58
|
|
clip: true
|
|
SpinBox {
|
|
id: spinBox
|
|
width: 140
|
|
height: 30
|
|
from: self.from
|
|
to: self.to
|
|
editable: true
|
|
value: parseInt(text)
|
|
anchors.centerIn: parent
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onWheel: (wheel)=>
|
|
{
|
|
if (wheel.angleDelta.y > 0) {
|
|
if (spinBox.value === spinBox.to) {
|
|
spinBox.value = spinBox.from
|
|
} else {
|
|
spinBox.value++
|
|
}
|
|
} else {
|
|
if (spinBox.value === spinBox.from) {
|
|
spinBox.value = spinBox.to
|
|
} else {
|
|
spinBox.value--
|
|
}
|
|
}
|
|
self.value = spinBox.value.toString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|