def paintEvent(self, event): p = QStylePainter(self) opt = QStyleOptionToolButton() self.initStyleOption(opt) if self.__text: # Replace the text opt.text = self.__text p.drawComplexControl(QStyle.CC_ToolButton, opt) p.end()
def paintEvent(self, event): p = QStylePainter(self) opt = QStyleOptionToolButton() self.initStyleOption(opt) if self.__text: # Replace the text opt.text = self.__text p.drawComplexControl(QStyle.CC_ToolButton, opt) p.end()
def paintEvent(self, event): painter = QStylePainter(self) option = QStyleOption() option.initFrom(self) rect = option.rect metrics = option.fontMetrics text = metrics.elidedText(self.__text, self.__textElideMode, rect.width()) painter.drawItemText(rect, self.__alignment, option.palette, self.isEnabled(), text, self.foregroundRole()) painter.end()
def paintEvent(self, event): painter = QStylePainter(self) option = QStyleOption() option.initFrom(self) rect = option.rect metrics = option.fontMetrics text = metrics.elidedText(self.__text, self.__textElideMode, rect.width()) painter.drawItemText(rect, self.__alignment, option.palette, self.isEnabled(), text, self.foregroundRole()) painter.end()
def paintEvent(self, event): painter = QStylePainter(self) option = QStyleOptionTab() for index in range(self.count()): self.initStyleOption(option, index) tabRect = self.tabRect(index) tabRect.moveLeft(10) tabRect.setLeft(0) painter.drawControl(QStyle.CE_TabBarTabShape, option) self.tabIcon(index).paint(painter, tabRect) painter.end()
def paintEvent(self, event): painter = QStylePainter(self) option = QStyleOptionTab() for index in range(self.count()): self.initStyleOption(option, index) tabRect = self.tabRect(index) tabRect.moveLeft(10) tabRect.setLeft(0) painter.drawControl(QStyle.CE_TabBarTabShape, option) self.tabIcon(index).paint(painter, tabRect) painter.end()
def paintEvent(self, event): """ Repaint tab in left-right text orientation. :param event: Repaint event signal """ painter = QStylePainter(self) option = QStyleOptionTab() for index in range(self.count()): self.initStyleOption(option, index) tabRect = self.tabRect(index) tabRect.moveLeft(10) painter.drawControl(QStyle.CE_TabBarTabShape, option) painter.drawText(tabRect, QtCore.Qt.AlignVCenter | QtCore.Qt.TextDontClip, self.tabText(index)) painter.end()