Support text base nentry fields.

main
Ben Niemann 1 year ago
parent aca7206aeb
commit 53f1f14abe

@ -81,7 +81,7 @@ ColumnLayout {
}
}
}
{%- elif item.type == 'nentry' -%}
{%- elif item.type == 'nentry' and item.enum -%}
ColumnLayout {
id: {{ item.label }}Control
property QtObject port: d.port("{{ item.label }}")
@ -91,7 +91,6 @@ ColumnLayout {
}
ComboBox {
id: cc
textRole: "name"
valueRole: "value"
model: ListModel {
@ -114,6 +113,28 @@ ColumnLayout {
onActivated: {{ item.label }}Control.port.setControlValue(currentValue);
}
}
{%- elif item.type == 'nentry' -%}
ColumnLayout {
id: {{ item.label }}Control
property QtObject port: d.port("{{ item.label }}")
Label {
text: "{{ item.label }}"
}
TextInput {
enabled: {{ item.label }}Control.port.numConnections == 0
text: "%1".arg({{ item.label }}Control.port.port.controlValue)
validator: RegExpValidator { regExp : /[.0-9]*/ }
onEditingFinished: function() {
if (text) {
var value = parseFloat(text);
value = Math.max({{ item.min }}, Math.min(value, {{ item.max }}));
{{ item.label }}Control.port.setControlValue(value);
}
}
}
}
{%- else -%}
ColumnLayout {
id: {{ item.label }}Control

Loading…
Cancel
Save