Skip to content

Commit 19f3301

Browse files
committed
canvas/nodeitem: Keep track of the text, avoid unnecessary updates
1 parent 380b2c3 commit 19f3301

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
@@ -681,6 +681,7 @@ def __init__(self, *args, **kwargs):
681681
super(NameTextItem, self).__init__(*args, **kwargs)
682682
self.__selected = False
683683
self.__palette = None
684+
self.__content = ""
684685

685686
def paint(self, painter, option, widget=None):
686687
if self.__selected:
@@ -743,6 +744,11 @@ def __updateDefaultTextColor(self):
743744
role = QPalette.WindowText
744745
self.setDefaultTextColor(self.palette().color(role))
745746

747+
def setHtml(self, contents):
748+
if contents != self.__content:
749+
self.__content = contents
750+
super().setHtml(contents)
751+
746752

747753
class NodeItem(QGraphicsObject):
748754
"""

0 commit comments

Comments
 (0)