mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-03 12:16:51 +02:00
[ui] GraphEditor: add readOnly mode
* disable node/edge edition * make GraphEditor readOnly when graph is being computed
This commit is contained in:
parent
5e17b12df1
commit
d2c26c3c84
4 changed files with 12 additions and 3 deletions
|
@ -9,6 +9,7 @@ Row {
|
|||
|
||||
property var nodeItem
|
||||
property var attribute
|
||||
property bool readOnly: false
|
||||
|
||||
// position of the anchor for attaching and edge to this attribute pin
|
||||
readonly property point edgeAnchorPos: Qt.point(edgeAnchor.x + edgeAnchor.width/2,
|
||||
|
@ -88,6 +89,7 @@ Row {
|
|||
id: connectMA
|
||||
drag.target: dragTarget
|
||||
drag.threshold: 0
|
||||
enabled: !root.readOnly
|
||||
anchors.fill: parent
|
||||
onReleased: dragTarget.Drag.drop()
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ Item {
|
|||
id: root
|
||||
|
||||
property variant graph: null
|
||||
|
||||
property bool readOnly: false
|
||||
property variant selectedNode: null
|
||||
|
||||
property int nodeWidth: 140
|
||||
|
@ -80,14 +80,14 @@ Item {
|
|||
property var dstAnchor: dst.nodeItem.mapFromItem(dst, dst.edgeAnchorPos.x, dst.edgeAnchorPos.y)
|
||||
|
||||
edge: object
|
||||
color: containsMouse ? palette.highlight : palette.text
|
||||
color: containsMouse && !readOnly ? palette.highlight : palette.text
|
||||
opacity: 0.7
|
||||
point1x: src.nodeItem.x + srcAnchor.x
|
||||
point1y: src.nodeItem.y + srcAnchor.y
|
||||
point2x: dst.nodeItem.x + dstAnchor.x
|
||||
point2y: dst.nodeItem.y + dstAnchor.y
|
||||
onPressed: {
|
||||
if(event.button == Qt.RightButton)
|
||||
if(!root.readOnly && event.button == Qt.RightButton)
|
||||
_reconstruction.removeEdge(edge)
|
||||
}
|
||||
}
|
||||
|
@ -104,6 +104,7 @@ Item {
|
|||
delegate: Node {
|
||||
node: object
|
||||
width: root.nodeWidth
|
||||
readOnly: root.readOnly
|
||||
|
||||
onAttributePinCreated: registerAttributePin(attribute, pin)
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -280,6 +280,7 @@ ApplicationWindow {
|
|||
graph: _reconstruction.graph
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
readOnly: _reconstruction.computing
|
||||
}
|
||||
}
|
||||
Item {
|
||||
|
|
Loading…
Add table
Reference in a new issue