diff --git a/nymea-app/ui/components/ThrottledSlider.qml b/nymea-app/ui/components/ThrottledSlider.qml index 80e45af6..434889a2 100644 --- a/nymea-app/ui/components/ThrottledSlider.qml +++ b/nymea-app/ui/components/ThrottledSlider.qml @@ -10,6 +10,9 @@ Item { property alias from: slider.from property alias to: slider.to property alias stepSize: slider.stepSize + + readonly property real rawValue: slider.value + signal moved(real value); Slider { diff --git a/nymea-app/ui/devicepages/GenericDevicePage.qml b/nymea-app/ui/devicepages/GenericDevicePage.qml index 7bf37dba..2c9cc36c 100644 --- a/nymea-app/ui/devicepages/GenericDevicePage.qml +++ b/nymea-app/ui/devicepages/GenericDevicePage.qml @@ -113,11 +113,13 @@ DevicePageBase { Label { Layout.fillWidth: true + Layout.minimumWidth: parent.width / 2 text: stateDelegate.stateType.displayName elide: Text.ElideRight } Loader { id: stateDelegateLoader + Layout.fillWidth: true sourceComponent: { switch (stateType.type.toLowerCase()) { case "string": @@ -144,7 +146,8 @@ DevicePageBase { } if (stateDelegate.writable) { - return spinBoxComponent; + return sliderComponent; +// return spinBoxComponent; } return numberLabelComponent; case "color": @@ -157,6 +160,11 @@ DevicePageBase { } } + Label { + visible: stateDelegateLoader.sourceComponent === sliderComponent + text: stateDelegate.deviceState.value + } + Label { visible: stateDelegate.stateType.unit !== Types.UnitUnixTime && stateDelegate.stateType.unitString.length > 0 text: stateDelegate.stateType.unitString @@ -412,7 +420,7 @@ DevicePageBase { SpinBox { width: 150 signal changed(var value) - stepSize: (to - from) / 10 + stepSize: (to - from) / 20 editable: true onValueModified: { changed(value) @@ -420,6 +428,15 @@ DevicePageBase { } } + Component { + id: sliderComponent + ThrottledSlider { + signal changed(var value) + stepSize: 1 + onMoved: changed(value) + } + } + Component { id: comboBoxComponent ComboBox {