Home
Phabricator
Search
Log In
Paste
P381
QQC2 SpinBox
Active
Public
Actions
Authored by
ngraham
on May 6 2019, 9:27 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
QQC2.SpinBox {
id: updateIntervalSpinBox
Kirigami.FormData.label: i18nc("@label:spinbox", "Update interval:")
// QQC2 SpinBox doesn't support decimal values so we need to go through
// this rigamarole
// See https://doc.qt.io/qt-5/qml-qtquick-controls2-spinbox.html#custom-values
property int decimals: 1
property real realValue: value / 10
from: 1
stepSize: 1
to: 10000
validator: DoubleValidator {
bottom: Math.min(updateIntervalSpinBox.from, updateIntervalSpinBox.to)
top: Math.max(updateIntervalSpinBox.from, updateIntervalSpinBox.to)
}
textFromValue: function(value) {
realValue = Number(value / 10)
return realValue
}
valueFromText: function(text, locale) {
return Number.fromLocaleString(locale, text) * 10
}
}
ngraham
created this paste.
May 6 2019, 9:27 PM
ngraham
created this object in space
S1 KDE Community
.
ngraham
mentioned this in
D21056: [System Load Viewer] Port settings window to QQC2+Kirigami FormLayout and modernize UI
.
Log In to Comment