diff --git a/nymea-app/ui/delegates/ParamDelegate.qml b/nymea-app/ui/delegates/ParamDelegate.qml index c488f9f9..1f354f9d 100644 --- a/nymea-app/ui/delegates/ParamDelegate.qml +++ b/nymea-app/ui/delegates/ParamDelegate.qml @@ -31,6 +31,7 @@ ItemDelegate { id: loader Layout.fillWidth: sourceComponent === textFieldComponent sourceComponent: { + print("loading paramdelegate:", root.writable, root.paramType.type) if (!root.writable) { return stringComponent; } @@ -39,7 +40,8 @@ ItemDelegate { case "bool": return boolComponent; case "int": - return spinnerComponent; + case "double": + return sliderComponent; case "string": case "qstring": if (root.paramType.allowedValues.length > 0) { @@ -104,22 +106,14 @@ ItemDelegate { id: sliderComponent RowLayout { spacing: app.margins - Label { - text: root.paramType.minValue - } Slider { id: slider Layout.fillWidth: true from: root.paramType.minValue to: root.paramType.maxValue value: root.param.value - stepSize: { - switch (root.paramType.type.toLowerCase()) { - case "int": - return 1; - } - return 0.01; - } + stepSize: 1 / (10 * decimals) + property int decimals: root.paramType.type.toLocaleLowerCase() === "int" ? 0 : 1 onMoved: { var newValue @@ -134,7 +128,7 @@ ItemDelegate { } } Label { - text: root.paramType.maxValue + text: root.param.value.toFixed(slider.decimals) + root.paramType.unitString } }