From d838e7866aad99f9f9812c276aa24f26de03a3b4 Mon Sep 17 00:00:00 2001 From: Julien-Haudegond <44610840+Julien-Haudegond@users.noreply.github.com> Date: Thu, 13 Aug 2020 11:45:52 +0200 Subject: [PATCH] [ui] Node: fix slowness due to QML function calls with a lot of nodes Instead of calling the duplicateList function for each node, at each modification, it is called only when we press the button. --- meshroom/core/node.py | 4 ++-- meshroom/ui/qml/GraphEditor/Node.qml | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/meshroom/core/node.py b/meshroom/core/node.py index 543f5438..4b23c621 100644 --- a/meshroom/core/node.py +++ b/meshroom/core/node.py @@ -868,12 +868,12 @@ class BaseNode(BaseObject): def updateDuplicates(self, nodesPerUid): """ Update the list of duplicate nodes (sharing the same uid). """ - if not nodesPerUid: + uid = self._uids.get(0) + if not nodesPerUid or not uid: self._duplicates.clear() self.duplicatesChanged.emit() return - uid = self._uids.get(0) self._duplicates.setObjectList([node for node in nodesPerUid.get(uid) if node != self]) self.duplicatesChanged.emit() diff --git a/meshroom/ui/qml/GraphEditor/Node.qml b/meshroom/ui/qml/GraphEditor/Node.qml index a79bfeea..58b6e36c 100755 --- a/meshroom/ui/qml/GraphEditor/Node.qml +++ b/meshroom/ui/qml/GraphEditor/Node.qml @@ -177,14 +177,17 @@ Item { spacing: 2 // Data sharing indicator - MaterialLabel { + MaterialToolButton { visible: node.duplicates.count > 0 text: MaterialIcons.layers font.pointSize: 7 padding: 2 palette.text: Colors.sysPalette.text - ToolTip.text: visible ? generateDuplicateList() : "" - ToolTip.delay: 250 + ToolTip.text: visible ? "Shares internal folder (data) with other node(s). Click for details." : "" + + onPressed: ToolTip.text = visible ? generateDuplicateList() : "" + onReleased: ToolTip.text = visible ? "Shares internal folder (data) with other node(s). Click for details." : "" + onCanceled: released() } // Submitted externally indicator