Skip to content

Commit 2f0996f

Browse files
committed
[ui] NodeEditor: Addressed the issue with retaining tabs when switching node selection
Updated the event trigger to be onVisibleChanged and the condition to check whether the current selected node is an incomputable node and the current tab index does not exist for it before resetting the index to 0
1 parent aeb77d8 commit 2f0996f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

meshroom/ui/qml/GraphEditor/NodeEditor.qml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,9 @@ Panel {
372372

373373
property bool isComputable: root.node !== null && root.node.isComputable
374374

375+
// The indices of the tab bar which can be shown for incomputable nodes
376+
readonly property var nonComputableTabIndices: [0, 4, 5];
377+
375378
Layout.fillWidth: true
376379
width: childrenRect.width
377380
position: TabBar.Footer
@@ -415,9 +418,11 @@ Panel {
415418
rightPadding: leftPadding
416419
}
417420

418-
onIsComputableChanged: {
419-
if (!isComputable) {
420-
tabBar.currentIndex = 0
421+
onVisibleChanged: {
422+
// If we have a node selected and the node is not Computable
423+
// Reset the currentIndex to 0, if the current index is not allowed for an incomputable node
424+
if ((root.node && !root.node.isComputable) && (nonComputableTabIndices.indexOf(tabBar.currentIndex) === -1)) {
425+
tabBar.currentIndex = 0;
421426
}
422427
}
423428
}

0 commit comments

Comments
 (0)