Skip to content

Commit

Permalink
[processing] draw vector icons when available in modeler
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Apr 30, 2018
1 parent 1370a5c commit 08db66f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion python/plugins/processing/modeler/ModelerGraphicItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,17 @@ def __init__(self, element, model, controls, scene=None):
self.pixmap = None
self.text = element.name()
else:
if element.algorithm().svgIconPath():
svg = QSvgRenderer(element.algorithm().svgIconPath())
size = svg.defaultSize()
self.picture = QPicture()
painter = QPainter(self.picture)
painter.scale(16 / size.width(), 16 / size.width())
svg.render(painter)
self.pixmap = None
else:
self.pixmap = element.algorithm().icon().pixmap(15, 15)
self.text = element.description()
self.pixmap = element.algorithm().icon().pixmap(15, 15)
self.arrows = []
self.setFlag(QGraphicsItem.ItemIsMovable, True)
self.setFlag(QGraphicsItem.ItemIsSelectable, True)
Expand Down

0 comments on commit 08db66f

Please sign in to comment.