[ui] GraphEditor: add readOnly mode

* disable node/edge edition
* make GraphEditor readOnly when graph is being computed
This commit is contained in:
Yann Lanthony 2017-11-28 11:05:05 +01:00
parent 5e17b12df1
commit d2c26c3c84
4 changed files with 12 additions and 3 deletions

View file

@ -6,6 +6,7 @@ import QtGraphicalEffects 1.0
Item {
id: root
property variant node: object
property bool readOnly: false
property color baseColor: "#607D8B"
property color shadowColor: "black"
@ -30,6 +31,7 @@ Item {
id: nodeMenu
MenuItem {
text: "Compute"
enabled: !root.readOnly
onTriggered: _reconstruction.execute(node)
}
MenuItem {
@ -39,6 +41,7 @@ Item {
MenuSeparator {}
MenuItem {
text: "Delete"
enabled: !root.readOnly
onTriggered: _reconstruction.removeNode(node)
}
}
@ -133,6 +136,7 @@ Item {
id: inPin
nodeItem: root
attribute: object
readOnly: root.readOnly
Component.onCompleted: attributePinCreated(attribute, inPin)
onChildPinCreated: attributePinCreated(childAttribute, inPin)
}
@ -155,6 +159,7 @@ Item {
id: outPin
nodeItem: root
attribute: object
readOnly: root.readOnly
Component.onCompleted: attributePinCreated(object, outPin)
}
}