Skip to content

Commit 51f46d5

Browse files
committed
canvas/nodeitem: Keep track of the text, avoid unnecessary updates
1 parent f8a6af1 commit 51f46d5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Orange/canvas/canvas/items/nodeitem.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ def __init__(self, *args, **kwargs):
691691
super(NameTextItem, self).__init__(*args, **kwargs)
692692
self.__selected = False
693693
self.__palette = None
694+
self.__content = ""
694695

695696
def paint(self, painter, option, widget=None):
696697
if self.__selected:
@@ -753,6 +754,11 @@ def __updateDefaultTextColor(self):
753754
role = QPalette.WindowText
754755
self.setDefaultTextColor(self.palette().color(role))
755756

757+
def setHtml(self, contents):
758+
if contents != self.__content:
759+
self.__content = contents
760+
super().setHtml(contents)
761+
756762

757763
class NodeItem(QGraphicsObject):
758764
"""

0 commit comments

Comments
 (0)