mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-04 12:46:44 +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 nodeItem
|
||||||
property var attribute
|
property var attribute
|
||||||
|
property bool readOnly: false
|
||||||
|
|
||||||
// position of the anchor for attaching and edge to this attribute pin
|
// position of the anchor for attaching and edge to this attribute pin
|
||||||
readonly property point edgeAnchorPos: Qt.point(edgeAnchor.x + edgeAnchor.width/2,
|
readonly property point edgeAnchorPos: Qt.point(edgeAnchor.x + edgeAnchor.width/2,
|
||||||
|
@ -88,6 +89,7 @@ Row {
|
||||||
id: connectMA
|
id: connectMA
|
||||||
drag.target: dragTarget
|
drag.target: dragTarget
|
||||||
drag.threshold: 0
|
drag.threshold: 0
|
||||||
|
enabled: !root.readOnly
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onReleased: dragTarget.Drag.drop()
|
onReleased: dragTarget.Drag.drop()
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property variant graph: null
|
property variant graph: null
|
||||||
|
property bool readOnly: false
|
||||||
property variant selectedNode: null
|
property variant selectedNode: null
|
||||||
|
|
||||||
property int nodeWidth: 140
|
property int nodeWidth: 140
|
||||||
|
@ -80,14 +80,14 @@ Item {
|
||||||
property var dstAnchor: dst.nodeItem.mapFromItem(dst, dst.edgeAnchorPos.x, dst.edgeAnchorPos.y)
|
property var dstAnchor: dst.nodeItem.mapFromItem(dst, dst.edgeAnchorPos.x, dst.edgeAnchorPos.y)
|
||||||
|
|
||||||
edge: object
|
edge: object
|
||||||
color: containsMouse ? palette.highlight : palette.text
|
color: containsMouse && !readOnly ? palette.highlight : palette.text
|
||||||
opacity: 0.7
|
opacity: 0.7
|
||||||
point1x: src.nodeItem.x + srcAnchor.x
|
point1x: src.nodeItem.x + srcAnchor.x
|
||||||
point1y: src.nodeItem.y + srcAnchor.y
|
point1y: src.nodeItem.y + srcAnchor.y
|
||||||
point2x: dst.nodeItem.x + dstAnchor.x
|
point2x: dst.nodeItem.x + dstAnchor.x
|
||||||
point2y: dst.nodeItem.y + dstAnchor.y
|
point2y: dst.nodeItem.y + dstAnchor.y
|
||||||
onPressed: {
|
onPressed: {
|
||||||
if(event.button == Qt.RightButton)
|
if(!root.readOnly && event.button == Qt.RightButton)
|
||||||
_reconstruction.removeEdge(edge)
|
_reconstruction.removeEdge(edge)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,7 @@ Item {
|
||||||
delegate: Node {
|
delegate: Node {
|
||||||
node: object
|
node: object
|
||||||
width: root.nodeWidth
|
width: root.nodeWidth
|
||||||
|
readOnly: root.readOnly
|
||||||
|
|
||||||
onAttributePinCreated: registerAttributePin(attribute, pin)
|
onAttributePinCreated: registerAttributePin(attribute, pin)
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import QtGraphicalEffects 1.0
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
property variant node: object
|
property variant node: object
|
||||||
|
property bool readOnly: false
|
||||||
property color baseColor: "#607D8B"
|
property color baseColor: "#607D8B"
|
||||||
property color shadowColor: "black"
|
property color shadowColor: "black"
|
||||||
|
|
||||||
|
@ -30,6 +31,7 @@ Item {
|
||||||
id: nodeMenu
|
id: nodeMenu
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: "Compute"
|
text: "Compute"
|
||||||
|
enabled: !root.readOnly
|
||||||
onTriggered: _reconstruction.execute(node)
|
onTriggered: _reconstruction.execute(node)
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
|
@ -39,6 +41,7 @@ Item {
|
||||||
MenuSeparator {}
|
MenuSeparator {}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: "Delete"
|
text: "Delete"
|
||||||
|
enabled: !root.readOnly
|
||||||
onTriggered: _reconstruction.removeNode(node)
|
onTriggered: _reconstruction.removeNode(node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,6 +136,7 @@ Item {
|
||||||
id: inPin
|
id: inPin
|
||||||
nodeItem: root
|
nodeItem: root
|
||||||
attribute: object
|
attribute: object
|
||||||
|
readOnly: root.readOnly
|
||||||
Component.onCompleted: attributePinCreated(attribute, inPin)
|
Component.onCompleted: attributePinCreated(attribute, inPin)
|
||||||
onChildPinCreated: attributePinCreated(childAttribute, inPin)
|
onChildPinCreated: attributePinCreated(childAttribute, inPin)
|
||||||
}
|
}
|
||||||
|
@ -155,6 +159,7 @@ Item {
|
||||||
id: outPin
|
id: outPin
|
||||||
nodeItem: root
|
nodeItem: root
|
||||||
attribute: object
|
attribute: object
|
||||||
|
readOnly: root.readOnly
|
||||||
Component.onCompleted: attributePinCreated(object, outPin)
|
Component.onCompleted: attributePinCreated(object, outPin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,6 +280,7 @@ ApplicationWindow {
|
||||||
graph: _reconstruction.graph
|
graph: _reconstruction.graph
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
readOnly: _reconstruction.computing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
|
|
Loading…
Add table
Reference in a new issue