summaryrefslogtreecommitdiffstats
path: root/demo/NodePage.qml
diff options
context:
space:
mode:
Diffstat (limited to 'demo/NodePage.qml')
-rw-r--r--demo/NodePage.qml47
1 files changed, 42 insertions, 5 deletions
diff --git a/demo/NodePage.qml b/demo/NodePage.qml
index 1468817..442a6fd 100644
--- a/demo/NodePage.qml
+++ b/demo/NodePage.qml
@@ -91,21 +91,28 @@ Page {
// Column headers
RowLayout {
Layout.fillWidth: true
- spacing: 0
+ Layout.leftMargin: 12
+ Layout.rightMargin: 12
+ spacing: 12
Label {
text: "Identifier"
font.bold: true
- Layout.preferredWidth: 200
- leftPadding: 12
+ Layout.preferredWidth: 160
}
Label {
text: "Value"
font.bold: true
+ Layout.preferredWidth: 160
+ }
+ Label {
+ text: "Write"
+ font.bold: true
Layout.fillWidth: true
}
}
Rectangle {
+ id: separator
Layout.fillWidth: true
height: 1
color: "#ccc"
@@ -128,6 +135,10 @@ Page {
id: node
nodeId: delegate.modelData
monitored: nodePage.StackView.status === StackView.Active
+ onWriteCompleted: (success, message) => {
+ var short_id = node.nodeId.substring(node.nodeId.indexOf(";s=") + 3);
+ nodePage.logFunction(short_id + ": " + message);
+ }
}
background: Rectangle {
@@ -137,19 +148,45 @@ Page {
contentItem: RowLayout {
spacing: 12
+
+ // Column 1: Identifier
Label {
text: {
var idx = node.nodeId.indexOf(";s=");
return idx >= 0 ? node.nodeId.substring(idx + 3) : node.nodeId;
}
- Layout.preferredWidth: 188
+ Layout.preferredWidth: 160
elide: Text.ElideRight
}
+
+ // Column 2: Live value (always visible)
Label {
text: node.value !== undefined && String(node.value) !== "" ? String(node.value) : "—"
- Layout.fillWidth: true
+ Layout.preferredWidth: 160
elide: Text.ElideRight
}
+
+ // Column 3: Edit area (writable) or READ-ONLY label
+ TextField {
+ id: editField
+ visible: node.writable
+ Layout.fillWidth: true
+ placeholderText: "Enter value..."
+ onAccepted: node.writeValue(text)
+ }
+ Button {
+ id: writeButton
+ visible: node.writable
+ text: "Write"
+ onClicked: node.writeValue(editField.text)
+ }
+ Label {
+ visible: !node.writable
+ text: "(READ-ONLY)"
+ color: "gray"
+ font.italic: true
+ Layout.fillWidth: true
+ }
}
ToolTip.visible: hovered