Merge PR #699: Fix uint handling in event descriptor delegate
This commit is contained in:
commit
d5ff20750d
@ -38,6 +38,7 @@ RowLayout {
|
|||||||
text: root.value
|
text: root.value
|
||||||
readOnly: !root.editable
|
readOnly: !root.editable
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
Layout.fillWidth: true
|
||||||
onTextEdited: {
|
onTextEdited: {
|
||||||
root.value = text
|
root.value = text
|
||||||
root.valueModified(root.value)
|
root.valueModified(root.value)
|
||||||
|
|||||||
@ -32,6 +32,7 @@ import QtQuick 2.4
|
|||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.2
|
||||||
import Nymea 1.0
|
import Nymea 1.0
|
||||||
|
import "../components"
|
||||||
|
|
||||||
ItemDelegate {
|
ItemDelegate {
|
||||||
id: root
|
id: root
|
||||||
@ -69,6 +70,7 @@ ItemDelegate {
|
|||||||
case "qstring":
|
case "qstring":
|
||||||
case "color":
|
case "color":
|
||||||
return false;
|
return false;
|
||||||
|
case "uint":
|
||||||
case "int":
|
case "int":
|
||||||
case "double":
|
case "double":
|
||||||
return true;
|
return true;
|
||||||
@ -116,12 +118,13 @@ ItemDelegate {
|
|||||||
switch (paramType.type.toLowerCase()) {
|
switch (paramType.type.toLowerCase()) {
|
||||||
case "bool":
|
case "bool":
|
||||||
return boolComponent;
|
return boolComponent;
|
||||||
|
case "uint":
|
||||||
case "int":
|
case "int":
|
||||||
case "double":
|
case "double":
|
||||||
if (paramType.minValue !== undefined && paramType.maxValue !== undefined) {
|
if (paramType.minValue !== undefined && paramType.maxValue !== undefined) {
|
||||||
return labelComponent;
|
return labelComponent;
|
||||||
}
|
}
|
||||||
return textFieldComponent;
|
return spinboxComponent;
|
||||||
case "string":
|
case "string":
|
||||||
case "qstring":
|
case "qstring":
|
||||||
case "color":
|
case "color":
|
||||||
@ -144,6 +147,7 @@ ItemDelegate {
|
|||||||
Loader {
|
Loader {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
|
print("***********+ loading", paramType.type)
|
||||||
switch (paramType.type.toLowerCase()) {
|
switch (paramType.type.toLowerCase()) {
|
||||||
case "int":
|
case "int":
|
||||||
case "double":
|
case "double":
|
||||||
@ -151,6 +155,7 @@ ItemDelegate {
|
|||||||
return sliderComponent
|
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 {
|
Component {
|
||||||
id: boolComponent
|
id: boolComponent
|
||||||
ComboBox {
|
ComboBox {
|
||||||
|
|||||||
Reference in New Issue
Block a user