示例#1
0
    def paintEvent(self, a0: QPaintEvent):
        o = QStyleOption()
        o.initFrom(self)

        p = QPainter(self)
        self.style().drawPrimitive(QStyle.PE_Widget, o, p, self)

        return super().paintEvent(a0)
示例#2
0
 def paintEvent(self, event: PySide2.QtGui.QPaintEvent):
     # super(DImageButton, self).paintEvent(event)
     # paint background
     painter = QPainter(self)
     painter.setRenderHint(QPainter.SmoothPixmapTransform)
     style_opt = QStyleOption()
     style_opt.init(self)
     if len(self._icon_list) < 4:
         return
     pix = self._icon_list[0]
     if self.isEnabled():
         if style_opt.state & QStyle.State_MouseOver:
             pix = self._icon_list[1]
         elif style_opt.state & QStyle.State_Selected:
             pix = self._icon_list[2]
     else:
         pix = self._icon_list[3]
     # x = abs(int((self.width() - pix.width()) / 2))
     # y = abs(int((self.height() - pix.height()) / 2))
     painter.drawPixmap(0, 0, pix)
示例#3
0
 def paintEvent(self, pe):
     o = QStyleOption()
     o.initFrom(self)
     p = QPainter(self)
     self.style().drawPrimitive(QStyle.PE_Widget, o, p, self)
示例#4
0
 def paintEvent(self, event):
     opt = QStyleOption()
     opt.init(self)
     p = QPainter(self)
     self.style().drawPrimitive(QStyle.PE_Widget, opt, p, self)
示例#5
0
 def paint_style_widget(self, painter):
     style_opt = QStyleOption()
     style_opt.init(self)
     self.style().drawPrimitive(QStyle.PE_Widget, style_opt, painter)
示例#6
0
 def paintEvent(self, event):
     option = QStyleOption()
     option.initFrom(self)
     painter = QPainter(self)
     self.style().drawPrimitive(QStyle.PE_Widget, option, painter, self)
     self.alternate_colors()
示例#7
0
 def paintEvent(self, event):  # just to enable stylesheets
     o = QStyleOption()
     o.initFrom(self)
     p = QPainter(self)
     self.style().drawPrimitive(QStyle.PE_Widget, o, p, self)