Ejemplo n.º 1
0
    def __init__(self, icon=None):

        # Get pixmap from given icon (None creates empty pixmap)
        self._pm = self._getPixmap(icon)

        # Instantiate painter for the pixmap
        self._painter = QtGui.QPainter()
        self._painter.begin(self._pm)
Ejemplo n.º 2
0
    def _addOverlays(self, icon, *overlays):

        # Get pixmap
        pm0 = icon.pixmap(16, 16)

        # Create painter
        painter = QtGui.QPainter()
        painter.begin(pm0)

        for overlay in overlays:
            pm1 = overlay.pixmap(16, 16)
            painter.drawPixmap(0, 0, pm1)

        # Finish
        painter.end()

        # Done (return resulting icon)
        return QtGui.QIcon(pm0)