Merge PR #699: Fix uint handling in event descriptor delegate

This commit is contained in:
Jenkins nymea 2021-11-03 13:58:32 +01:00
commit d5ff20750d
2 changed files with 18 additions and 1 deletions

View File

@ -38,6 +38,7 @@ RowLayout {
text: root.value
readOnly: !root.editable
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
onTextEdited: {
root.value = text
root.valueModified(root.value)

View File

@ -32,6 +32,7 @@ import QtQuick 2.4
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.2
import Nymea 1.0
import "../components"
ItemDelegate {
id: root
@ -69,6 +70,7 @@ ItemDelegate {
case "qstring":
case "color":
return false;
case "uint":
case "int":
case "double":
return true;
@ -116,12 +118,13 @@ ItemDelegate {
switch (paramType.type.toLowerCase()) {
case "bool":
return boolComponent;
case "uint":
case "int":
case "double":
if (paramType.minValue !== undefined && paramType.maxValue !== undefined) {
return labelComponent;
}
return textFieldComponent;
return spinboxComponent;
case "string":
case "qstring":
case "color":
@ -144,6 +147,7 @@ ItemDelegate {
Loader {
Layout.fillWidth: true
sourceComponent: {
print("***********+ loading", paramType.type)
switch (paramType.type.toLowerCase()) {
case "int":
case "double":
@ -151,6 +155,7 @@ ItemDelegate {
return sliderComponent
}
}
}
}
@ -206,6 +211,17 @@ ItemDelegate {
}
Component {
id: spinboxComponent
NymeaSpinBox {
from: paramType.minValue
to: paramType.maxValue
value: root.value != undefined ? root.value : 0
onValueModified: root.value = value
floatingPoint: root.paramType.type.toLowerCase() === "double"
}
}
Component {
id: boolComponent
ComboBox {