punktdateien/kde/plasma/plasmoids/org.kde.plasma.win7showdesktop/contents/ui/lib/ConfigSpinBox.qml

48 lines
1 KiB
QML
Raw Normal View History

2024-02-14 21:14:16 +01:00
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
RowLayout {
id: configSpinBox
property string configKey: ''
property alias decimals: spinBox.decimals
property alias horizontalAlignment: spinBox.horizontalAlignment
property alias maximumValue: spinBox.maximumValue
property alias minimumValue: spinBox.minimumValue
property alias prefix: spinBox.prefix
property alias stepSize: spinBox.stepSize
property alias suffix: spinBox.suffix
property alias value: spinBox.value
property alias before: labelBefore.text
property alias after: labelAfter.text
Label {
id: labelBefore
text: ""
visible: text
}
SpinBox {
id: spinBox
value: plasmoid.configuration[configKey]
// onValueChanged: plasmoid.configuration[configKey] = value
onValueChanged: serializeTimer.start()
maximumValue: 2147483647
}
Label {
id: labelAfter
text: ""
visible: text
}
Timer { // throttle
id: serializeTimer
interval: 300
onTriggered: plasmoid.configuration[configKey] = value
}
}