Skip to content

Commit 08db66f

Browse files
committedApr 30, 2018
[processing] draw vector icons when available in modeler
1 parent 1370a5c commit 08db66f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed
 

‎python/plugins/processing/modeler/ModelerGraphicItem.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,17 @@ def __init__(self, element, model, controls, scene=None):
7575
self.pixmap = None
7676
self.text = element.name()
7777
else:
78+
if element.algorithm().svgIconPath():
79+
svg = QSvgRenderer(element.algorithm().svgIconPath())
80+
size = svg.defaultSize()
81+
self.picture = QPicture()
82+
painter = QPainter(self.picture)
83+
painter.scale(16 / size.width(), 16 / size.width())
84+
svg.render(painter)
85+
self.pixmap = None
86+
else:
87+
self.pixmap = element.algorithm().icon().pixmap(15, 15)
7888
self.text = element.description()
79-
self.pixmap = element.algorithm().icon().pixmap(15, 15)
8089
self.arrows = []
8190
self.setFlag(QGraphicsItem.ItemIsMovable, True)
8291
self.setFlag(QGraphicsItem.ItemIsSelectable, True)

0 commit comments

Comments
 (0)