From cf2a45c82e09ef338ea570db5f88ced53ebb574d Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 11 Feb 2019 19:18:20 +0100 Subject: [PATCH] Fix ParamDelegate for uint --- nymea-app/ui/delegates/ParamDelegate.qml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/nymea-app/ui/delegates/ParamDelegate.qml b/nymea-app/ui/delegates/ParamDelegate.qml index a76cf1a9..674a82cd 100644 --- a/nymea-app/ui/delegates/ParamDelegate.qml +++ b/nymea-app/ui/delegates/ParamDelegate.qml @@ -24,6 +24,7 @@ ItemDelegate { RowLayout { Label { Layout.fillWidth: true + Layout.minimumWidth: parent.width / 2 text: root.paramType.displayName elide: Text.ElideRight } @@ -39,9 +40,14 @@ ItemDelegate { switch (root.paramType.type.toLowerCase()) { case "bool": return boolComponent; + case "uint": case "int": case "double": - return sliderComponent; + if (root.paramType.minValue && root.paramType.maxValue) { + return sliderComponent; + } else { + return spinnerComponent; + } case "string": case "qstring": if (root.paramType.allowedValues.length > 0) { @@ -144,8 +150,14 @@ ItemDelegate { id: spinnerComponent SpinBox { value: root.param.value ? root.param.value : 0 - from: root.paramType.minValue ? root.paramType.minValue : -999999999 - to: root.paramType.maxValue ? root.paramType.maxValue : 999999999 + from: root.paramType.minValue + ? root.paramType.minValue + : root.paramType.type.toLowerCase() === "uint" + ? 0 + : -2000000000 + to: root.paramType.maxValue + ? root.paramType.maxValue + : 2000000000 editable: true width: 150 onValueModified: root.param.value = value