go back to using a slider instead of the spinner
This commit is contained in:
parent
cea41bdbcc
commit
6b95be2e40
@ -10,6 +10,9 @@ Item {
|
|||||||
property alias from: slider.from
|
property alias from: slider.from
|
||||||
property alias to: slider.to
|
property alias to: slider.to
|
||||||
property alias stepSize: slider.stepSize
|
property alias stepSize: slider.stepSize
|
||||||
|
|
||||||
|
readonly property real rawValue: slider.value
|
||||||
|
|
||||||
signal moved(real value);
|
signal moved(real value);
|
||||||
|
|
||||||
Slider {
|
Slider {
|
||||||
|
|||||||
@ -113,11 +113,13 @@ DevicePageBase {
|
|||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.minimumWidth: parent.width / 2
|
||||||
text: stateDelegate.stateType.displayName
|
text: stateDelegate.stateType.displayName
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
Loader {
|
Loader {
|
||||||
id: stateDelegateLoader
|
id: stateDelegateLoader
|
||||||
|
Layout.fillWidth: true
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
switch (stateType.type.toLowerCase()) {
|
switch (stateType.type.toLowerCase()) {
|
||||||
case "string":
|
case "string":
|
||||||
@ -144,7 +146,8 @@ DevicePageBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stateDelegate.writable) {
|
if (stateDelegate.writable) {
|
||||||
return spinBoxComponent;
|
return sliderComponent;
|
||||||
|
// return spinBoxComponent;
|
||||||
}
|
}
|
||||||
return numberLabelComponent;
|
return numberLabelComponent;
|
||||||
case "color":
|
case "color":
|
||||||
@ -157,6 +160,11 @@ DevicePageBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
visible: stateDelegateLoader.sourceComponent === sliderComponent
|
||||||
|
text: stateDelegate.deviceState.value
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
visible: stateDelegate.stateType.unit !== Types.UnitUnixTime && stateDelegate.stateType.unitString.length > 0
|
visible: stateDelegate.stateType.unit !== Types.UnitUnixTime && stateDelegate.stateType.unitString.length > 0
|
||||||
text: stateDelegate.stateType.unitString
|
text: stateDelegate.stateType.unitString
|
||||||
@ -412,7 +420,7 @@ DevicePageBase {
|
|||||||
SpinBox {
|
SpinBox {
|
||||||
width: 150
|
width: 150
|
||||||
signal changed(var value)
|
signal changed(var value)
|
||||||
stepSize: (to - from) / 10
|
stepSize: (to - from) / 20
|
||||||
editable: true
|
editable: true
|
||||||
onValueModified: {
|
onValueModified: {
|
||||||
changed(value)
|
changed(value)
|
||||||
@ -420,6 +428,15 @@ DevicePageBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: sliderComponent
|
||||||
|
ThrottledSlider {
|
||||||
|
signal changed(var value)
|
||||||
|
stepSize: 1
|
||||||
|
onMoved: changed(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: comboBoxComponent
|
id: comboBoxComponent
|
||||||
ComboBox {
|
ComboBox {
|
||||||
|
|||||||
Reference in New Issue
Block a user