Fix ParamDelegate for uint

This commit is contained in:
Michael Zanetti 2019-02-11 19:18:20 +01:00
parent f9730626ad
commit cf2a45c82e

View File

@ -24,6 +24,7 @@ ItemDelegate {
RowLayout { RowLayout {
Label { Label {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: parent.width / 2
text: root.paramType.displayName text: root.paramType.displayName
elide: Text.ElideRight elide: Text.ElideRight
} }
@ -39,9 +40,14 @@ ItemDelegate {
switch (root.paramType.type.toLowerCase()) { switch (root.paramType.type.toLowerCase()) {
case "bool": case "bool":
return boolComponent; return boolComponent;
case "uint":
case "int": case "int":
case "double": case "double":
return sliderComponent; if (root.paramType.minValue && root.paramType.maxValue) {
return sliderComponent;
} else {
return spinnerComponent;
}
case "string": case "string":
case "qstring": case "qstring":
if (root.paramType.allowedValues.length > 0) { if (root.paramType.allowedValues.length > 0) {
@ -144,8 +150,14 @@ ItemDelegate {
id: spinnerComponent id: spinnerComponent
SpinBox { SpinBox {
value: root.param.value ? root.param.value : 0 value: root.param.value ? root.param.value : 0
from: root.paramType.minValue ? root.paramType.minValue : -999999999 from: root.paramType.minValue
to: root.paramType.maxValue ? root.paramType.maxValue : 999999999 ? root.paramType.minValue
: root.paramType.type.toLowerCase() === "uint"
? 0
: -2000000000
to: root.paramType.maxValue
? root.paramType.maxValue
: 2000000000
editable: true editable: true
width: 150 width: 150
onValueModified: root.param.value = value onValueModified: root.param.value = value