Skip to content

Commit 3b1f6b6

Browse files
authored
Merge pull request #461 from jonassorgenfrei/icon-scale-to-max-width
Node Icon Max Width
2 parents ec50a21 + 24c4179 commit 3b1f6b6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

NodeGraphQt/qgraphics/node_base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,11 @@ def icon(self, path=None):
804804
NodeEnum.ICON_SIZE.value,
805805
QtCore.Qt.SmoothTransformation
806806
)
807+
if pixmap.size().width() > NodeEnum.ICON_SIZE.value:
808+
pixmap = pixmap.scaledToWidth(
809+
NodeEnum.ICON_SIZE.value,
810+
QtCore.Qt.SmoothTransformation
811+
)
807812
self._icon_item.setPixmap(pixmap)
808813
if self.scene():
809814
self.post_init()

0 commit comments

Comments
 (0)