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)
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)
def paintEvent(self, pe): o = QStyleOption() o.initFrom(self) p = QPainter(self) self.style().drawPrimitive(QStyle.PE_Widget, o, p, self)
def paintEvent(self, event): opt = QStyleOption() opt.init(self) p = QPainter(self) self.style().drawPrimitive(QStyle.PE_Widget, opt, p, self)
def paint_style_widget(self, painter): style_opt = QStyleOption() style_opt.init(self) self.style().drawPrimitive(QStyle.PE_Widget, style_opt, painter)
def paintEvent(self, event): option = QStyleOption() option.initFrom(self) painter = QPainter(self) self.style().drawPrimitive(QStyle.PE_Widget, option, painter, self) self.alternate_colors()
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)