Skip to content

Commit 78941e3

Browse files
committed
[GraphEditor] Clean-up backdrop-related code
- Remove useless `isBackdropNode` property in Node.qml - Remove useless `isBackdrop` property in Backdrop.qml - Use `getItemAt` accessor when relevant - Fix typos in property names and comments - Remove semicolons when they are not needed
1 parent 3fd151d commit 78941e3

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

meshroom/ui/qml/GraphEditor/Backdrop.qml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Item {
2525
// The item instantiating the delegates
2626
property Item modelInstantiator: undefined
2727

28-
readonly property bool isBackdrop: true
2928
// Node children for the Backdrop
3029
property var children: []
3130
property var childrenIndices: []
@@ -40,7 +39,7 @@ Item {
4039
property color baseColor: defaultColor
4140

4241
readonly property int minimumWidth: 200
43-
readonly property int minumumHeight: 200
42+
readonly property int minimumHeight: 200
4443

4544
property point mousePosition: Qt.point(mouseArea.mouseX, mouseArea.mouseY)
4645

@@ -97,7 +96,7 @@ Item {
9796
}
9897

9998
// When the node is selected, update the children for it
100-
// For node to consider another ndoe, it needs to be fully inside the backdrop area
99+
// For node to consider another node, it needs to be fully inside the backdrop area
101100
onSelectedChanged: {
102101
if (selected) {
103102
updateChildren()
@@ -114,11 +113,11 @@ Item {
114113
const backdropRect = Qt.rect(root.node.x, root.node.y, root.node.nodeWidth, root.node.nodeHeight)
115114

116115
for (var i = 0; i < modelInstantiator.count; ++i) {
117-
const delegate = modelInstantiator.itemAt(i).item
118-
if (delegate === this)
116+
const delegate = modelInstantiator.getItemAt(i)
117+
if (!delegate || delegate === this)
119118
continue
120119

121-
const delegateRect = Qt.rect(delegate.x, delegate.y, delegate.width, delegate.height);
120+
const delegateRect = Qt.rect(delegate.x, delegate.y, delegate.width, delegate.height)
122121
if (Geom2D.rectRectFullIntersect(backdropRect, delegateRect)) {
123122
indices.push(i)
124123
nodes.push(delegate)
@@ -147,8 +146,8 @@ Item {
147146
// Main Layout
148147
MouseArea {
149148
id: mouseArea
150-
width: root.width;
151-
height: root.height;
149+
width: root.width
150+
height: root.height
152151
drag.target: root
153152
// Small drag threshold to avoid moving the node by mistake
154153
drag.threshold: 2
@@ -201,12 +200,12 @@ Item {
201200
}
202201

203202
onReleased: {
204-
root.resized(root.width, nodeContent.height);
203+
root.resized(root.width, nodeContent.height)
205204
}
206205
}
207206
}
208207

209-
// Resize: left size
208+
// Resize: left side
210209
Rectangle {
211210
width: 4
212211
height: nodeContent.height
@@ -273,8 +272,8 @@ Item {
273272
root.height = root.height + mouseY
274273

275274
// Ensure a minimum height
276-
if (root.height < root.minumumHeight) {
277-
root.height = root.minumumHeight
275+
if (root.height < root.minimumHeight) {
276+
root.height = root.minimumHeight
278277
}
279278
}
280279
}
@@ -308,7 +307,7 @@ Item {
308307
let h = root.height - mouseY
309308

310309
// Ensure a minimum height
311-
if (h > root.minumumHeight) {
310+
if (h > root.minimumHeight) {
312311
// Update the node's y position and the height
313312
root.y = root.y + mouseY
314313
root.height = h
@@ -318,7 +317,7 @@ Item {
318317

319318
onReleased: {
320319
// Dragging from the top moves the node as well
321-
root.resizedAndMoved(root.width, root.height, Qt.point(root.x, root.y));
320+
root.resizedAndMoved(root.width, root.height, Qt.point(root.x, root.y))
322321
}
323322
}
324323
}

meshroom/ui/qml/GraphEditor/GraphEditor.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ Item {
11731173

11741174
uigraph.nodeSelection.selectedIndexes.forEach(function(idx) {
11751175
if (idx != index) {
1176-
const delegate = nodeRepeater.itemAt(idx.row).item
1176+
const delegate = nodeRepeater.getItemAt(idx.row)
11771177
delegate.x = delegate.node.x + offset.x
11781178
delegate.y = delegate.node.y + offset.y
11791179
}

meshroom/ui/qml/GraphEditor/Node.qml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Item {
1919
property bool readOnly: node.locked
2020
/// Whether the node is in compatibility mode
2121
readonly property bool isCompatibilityNode: node ? node.hasOwnProperty("compatibilityIssue") : false
22-
readonly property bool isBackdropNode: node ? node.isBackdropNode : false
2322
/// Mouse related states
2423
property bool mainSelected: false
2524
property bool selected: false

0 commit comments

Comments
 (0)