Beispiel #1
0
    def paint(self, painter, option, index):
        """Paint a toolbutton with an icon."""
        super(ToolButtonDelegate, self).paint(painter, option, index)

        opt = QStyleOptionToolButton()
        opt.rect = self.get_btn_rect(option)
        opt.iconSize = icons.get_iconsize('small')
        opt.state |= QStyle.State_Enabled | QStyle.State_Raised
        opt.icon = icons.get_icon('erase-right')

        QApplication.style().drawControl(QStyle.CE_ToolButtonLabel, opt,
                                         painter)
Beispiel #2
0
 def paintEvent(self, event):
     p = QPainter(self)
     r = self.rect()
     opt = QStyleOptionToolButton()
     opt.init(self)
     opt.state |= QStyle.State_AutoRaise
     if self.isEnabled() and self.underMouse() and \
        not self.isChecked() and not self.isDown():
         opt.state |= QStyle.State_Raised
     if self.isChecked():
         opt.state |= QStyle.State_On
     if self.isDown():
         opt.state |= QStyle.State_Sunken
     self.style().drawPrimitive(QStyle.PE_PanelButtonTool, opt, p, self)
     opt.icon = self.icon()
     opt.subControls = QStyle.SubControls()
     opt.activeSubControls = QStyle.SubControls()
     opt.features = QStyleOptionToolButton.None
     opt.arrowType = Qt.NoArrow
     size = self.style().pixelMetric(QStyle.PM_SmallIconSize, None, self)
     opt.iconSize = QSize(size, size)
     self.style().drawComplexControl(QStyle.CC_ToolButton, opt, p, self)
Beispiel #3
0
 def paintEvent(self, event):
     painter = QStylePainter(self)
     option = QStyleOptionToolButton()
     self.initStyleOption(option)
     option.icon = self.animation_icons[self.animation_icon_index]
     painter.drawComplexControl(QStyle.CC_ToolButton, option)
Beispiel #4
0
 def paintEvent(self, event):
     painter = QStylePainter(self)
     option = QStyleOptionToolButton()
     self.initStyleOption(option)
     option.icon = self.animation_icons[self.animation_icon_index]
     painter.drawComplexControl(QStyle.CC_ToolButton, option)