Exemplo n.º 1
0
    def paintEvent(self, theEvent):
        """Custom implementation of the label painter that rotates the
        label 90 degrees.
        """
        pObj = QStylePainter(self)
        oObj = QStyleOptionTab()

        for i in range(self.count()):
            self.initStyleOption(oObj, i)
            pObj.drawControl(QStyle.CE_TabBarTabShape, oObj)
            pObj.save()

            oSize = oObj.rect.size()
            oSize.transpose()
            oRect = QRect(QPoint(), oSize)
            oRect.moveCenter(oObj.rect.center())
            oObj.rect = oRect

            oCenter = self.tabRect(i).center()
            pObj.translate(oCenter)
            pObj.rotate(90)
            pObj.translate(-oCenter)
            pObj.drawControl(QStyle.CE_TabBarTabLabel, oObj)
            pObj.restore()

        return
Exemplo n.º 2
0
 def paintEvent(self, event):
     self._initAnimate()
     painter = QStylePainter(self)
     painter.setRenderHint(QPainter.Antialiasing, True)
     painter.setRenderHint(QPainter.HighQualityAntialiasing, True)
     painter.setRenderHint(QPainter.SmoothPixmapTransform, True)
     painter.setBrush(QColor(self._bgcolor))
     painter.setPen(QColor(self._bgcolor))
     painter.drawEllipse(QRectF(
         (self.minimumWidth() - self._width) / 2,
         (self.minimumHeight() - self._height) / 2,
         self._width,
         self._height
     ))
     # 绘制本身的文字和图标
     options = QStyleOptionButton()
     options.initFrom(self)
     size = options.rect.size()
     size.transpose()
     options.rect.setSize(size)
     options.features = QStyleOptionButton.Flat
     options.text = self.text()
     options.icon = self.icon()
     options.iconSize = self.iconSize()
     painter.drawControl(QStyle.CE_PushButton, options)
     event.accept()
Exemplo n.º 3
0
    def paintEvent(self, _e):
        """Override paintEvent to draw the tabs like we want to."""
        # pylint: disable=bad-config-call
        # WORKAROUND for https://bitbucket.org/logilab/astroid/issue/104
        p = QStylePainter(self)
        selected = self.currentIndex()
        for idx in range(self.count()):
            tab = QStyleOptionTab()
            self.initStyleOption(tab, idx)

            bg_parts = ['tabs', 'bg']
            fg_parts = ['tabs', 'fg']
            if idx == selected:
                bg_parts.append('selected')
                fg_parts.append('selected')

            if idx % 2:
                bg_parts.append('odd')
                fg_parts.append('odd')
            else:
                bg_parts.append('even')
                fg_parts.append('even')

            bg_color = config.get('colors', '.'.join(bg_parts))
            fg_color = config.get('colors', '.'.join(fg_parts))
            tab.palette.setColor(QPalette.Window, bg_color)
            tab.palette.setColor(QPalette.WindowText, fg_color)

            indicator_color = self.tab_indicator_color(idx)
            tab.palette.setColor(QPalette.Base, indicator_color)
            if tab.rect.right() < 0 or tab.rect.left() > self.width():
                # Don't bother drawing a tab if the entire tab is outside of
                # the visible tab bar.
                continue
            p.drawControl(QStyle.CE_TabBarTab, tab)
Exemplo n.º 4
0
    def paintEvent(self, event):
        """Override paintEvent to draw the tabs like we want to."""
        p = QStylePainter(self)
        selected = self.currentIndex()
        for idx in range(self.count()):
            if not event.region().intersects(self.tabRect(idx)):
                # Don't repaint if we are outside the requested region
                continue

            tab = QStyleOptionTab()
            self.initStyleOption(tab, idx)

            setting = 'colors.tabs'
            if idx == selected:
                setting += '.selected'
            setting += '.odd' if (idx + 1) % 2 else '.even'

            tab.palette.setColor(QPalette.Window,
                                 config.cache[setting + '.bg'])
            tab.palette.setColor(QPalette.WindowText,
                                 config.cache[setting + '.fg'])

            indicator_color = self.tab_indicator_color(idx)
            tab.palette.setColor(QPalette.Base, indicator_color)
            p.drawControl(QStyle.CE_TabBarTab, tab)
Exemplo n.º 5
0
    def paintEvent(self, _e):
        """Override paintEvent to draw the tabs like we want to."""
        # pylint: disable=bad-config-call
        # WORKAROUND for https://bitbucket.org/logilab/astroid/issue/104
        p = QStylePainter(self)
        selected = self.currentIndex()
        for idx in range(self.count()):
            tab = QStyleOptionTab()
            self.initStyleOption(tab, idx)

            bg_parts = ['tabs', 'bg']
            fg_parts = ['tabs', 'fg']
            if idx == selected:
                bg_parts.append('selected')
                fg_parts.append('selected')

            if idx % 2:
                bg_parts.append('odd')
                fg_parts.append('odd')
            else:
                bg_parts.append('even')
                fg_parts.append('even')

            bg_color = config.get('colors', '.'.join(bg_parts))
            fg_color = config.get('colors', '.'.join(fg_parts))
            tab.palette.setColor(QPalette.Window, bg_color)
            tab.palette.setColor(QPalette.WindowText, fg_color)

            indicator_color = self.tab_indicator_color(idx)
            tab.palette.setColor(QPalette.Base, indicator_color)
            if tab.rect.right() < 0 or tab.rect.left() > self.width():
                # Don't bother drawing a tab if the entire tab is outside of
                # the visible tab bar.
                continue
            p.drawControl(QStyle.CE_TabBarTab, tab)
Exemplo n.º 6
0
    def paintEvent(self, _e):
        """Override paintEvent to draw the tabs like we want to."""
        p = QStylePainter(self)
        selected = self.currentIndex()
        for idx in range(self.count()):
            tab = QStyleOptionTab()
            self.initStyleOption(tab, idx)

            # pylint: disable=bad-config-option
            setting = config.val.colors.tabs
            # pylint: enable=bad-config-option
            if idx == selected:
                setting = setting.selected
            setting = setting.odd if (idx + 1) % 2 else setting.even

            tab.palette.setColor(QPalette.Window, setting.bg)
            tab.palette.setColor(QPalette.WindowText, setting.fg)

            indicator_color = self.tab_indicator_color(idx)
            tab.palette.setColor(QPalette.Base, indicator_color)
            if tab.rect.right() < 0 or tab.rect.left() > self.width():
                # Don't bother drawing a tab if the entire tab is outside of
                # the visible tab bar.
                continue
            p.drawControl(QStyle.CE_TabBarTab, tab)
Exemplo n.º 7
0
    def paintEvent(self, event):
        """Override paintEvent to draw the tabs like we want to."""
        p = QStylePainter(self)
        selected = self.currentIndex()
        for idx in range(self.count()):
            if not event.region().intersects(self.tabRect(idx)):
                # Don't repaint if we are outside the requested region
                continue

            tab = QStyleOptionTab()
            self.initStyleOption(tab, idx)

            setting = 'colors.tabs'
            if self._tab_pinned(idx):
                setting += '.pinned'
            if idx == selected:
                setting += '.selected'
            setting += '.odd' if (idx + 1) % 2 else '.even'

            tab.palette.setColor(QPalette.Window,
                                 config.cache[setting + '.bg'])
            tab.palette.setColor(QPalette.WindowText,
                                 config.cache[setting + '.fg'])

            indicator_color = self.tab_indicator_color(idx)
            tab.palette.setColor(QPalette.Base, indicator_color)
            p.drawControl(QStyle.CE_TabBarTab, tab)
Exemplo n.º 8
0
    def paintEvent(self, _e):
        """Override paintEvent to draw the tabs like we want to."""
        p = QStylePainter(self)
        selected = self.currentIndex()
        for idx in range(self.count()):
            tab = QStyleOptionTab()
            self.initStyleOption(tab, idx)

            setting = 'colors.tabs'
            if idx == selected:
                setting += '.selected'
            setting += '.odd' if (idx + 1) % 2 else '.even'

            tab.palette.setColor(QPalette.Window,
                                 config.cache[setting + '.bg'])
            tab.palette.setColor(QPalette.WindowText,
                                 config.cache[setting + '.fg'])

            indicator_color = self.tab_indicator_color(idx)
            tab.palette.setColor(QPalette.Base, indicator_color)
            if tab.rect.right() < 0 or tab.rect.left() > self.width():
                # Don't bother drawing a tab if the entire tab is outside of
                # the visible tab bar.
                continue
            p.drawControl(QStyle.CE_TabBarTab, tab)
Exemplo n.º 9
0
    def paintEvent(self, event):
        """绘制事件"""
        text = self.text()
        option = QStyleOptionButton()
        self.initStyleOption(option)
        option.text = ''  # 不绘制文字
        painter = QStylePainter(self)
        painter.setRenderHint(QStylePainter.Antialiasing)
        painter.setRenderHint(QStylePainter.HighQualityAntialiasing)
        painter.setRenderHint(QStylePainter.SmoothPixmapTransform)
        painter.drawControl(QStyle.CE_PushButton, option)
        # 变换坐标为正中间
        painter.translate(self.rect().center())
        painter.rotate(self._angle)  # 旋转

        # 绘制图片
        if self._pixmap and not self._pixmap.isNull():
            w = self.width()
            h = self.height()
            pos = QPointF(-self._pixmap.width() / 2,
                          -self._pixmap.height() / 2)
            painter.drawPixmap(pos, self._pixmap)
        elif text:
            # 在变换坐标后的正中间画文字
            fm = self.fontMetrics()
            w = fm.width(text)
            h = fm.height()
            rect = QRectF(0 - w * 2, 0 - h, w * 2 * 2, h * 2)
            painter.drawText(rect, Qt.AlignCenter, text)
        else:
            super(RotateButton, self).paintEvent(event)
Exemplo n.º 10
0
 def paintEvent(self, _e):
     """Override paintEvent to draw the tabs like we want to."""
     p = QStylePainter(self)
     tab = QStyleOptionTab()
     selected = self.currentIndex()
     for idx in range(self.count()):
         self.initStyleOption(tab, idx)
         if idx == selected:
             bg_color = config.get('colors', 'tabs.bg.selected')
             fg_color = config.get('colors', 'tabs.fg.selected')
         elif idx % 2:
             bg_color = config.get('colors', 'tabs.bg.odd')
             fg_color = config.get('colors', 'tabs.fg.odd')
         else:
             bg_color = config.get('colors', 'tabs.bg.even')
             fg_color = config.get('colors', 'tabs.fg.even')
         tab.palette.setColor(QPalette.Window, bg_color)
         tab.palette.setColor(QPalette.WindowText, fg_color)
         indicator_color = self.tabData(idx)
         if indicator_color is None:
             indicator_color = QColor()
         tab.palette.setColor(QPalette.Base, indicator_color)
         if tab.rect.right() < 0 or tab.rect.left() > self.width():
             # Don't bother drawing a tab if the entire tab is outside of
             # the visible tab bar.
             continue
         p.drawControl(QStyle.CE_TabBarTab, tab)
Exemplo n.º 11
0
 def paintEvent(self, _):
     option = QStyleOptionButton()
     self.initStyleOption(option)
     painter = QStylePainter(self)
     if self._rotateAnimationStarted:
         option.text = ""
     painter.drawControl(QStyle.CE_PushButton, option)
     if not self._rotateAnimationStarted:
         return
     painter.save()
     font = self.font()
     font.setPointSize(self.fontSize)
     font.setFamily("FontAwesome")
     painter.setFont(font)
     # 变换坐标为正中间
     painter.translate(self.rect().center())
     # 旋转90度
     painter.rotate(self._rotateAnimation.currentValue() * 30)
     fm = self.fontMetrics()
     # 在变换坐标后的正中间画文字
     w = fm.width(self.LoadingText)
     h = fm.height()
     painter.drawText(QRectF(0 - w * 2, 0 - h, w * 2 * 2, h * 2),
                      Qt.AlignCenter, self.LoadingText)
     painter.restore()
Exemplo n.º 12
0
    def paintEvent(self, _e):
        """Override paintEvent to draw the tabs like we want to."""
        p = QStylePainter(self)
        selected = self.currentIndex()
        for idx in range(self.count()):
            tab = QStyleOptionTab()
            self.initStyleOption(tab, idx)

            # pylint: disable=bad-config-option
            setting = config.val.colors.tabs
            # pylint: enable=bad-config-option
            if idx == selected:
                setting = setting.selected
            setting = setting.odd if (idx + 1) % 2 else setting.even

            tab.palette.setColor(QPalette.Window, setting.bg)
            tab.palette.setColor(QPalette.WindowText, setting.fg)

            indicator_color = self.tab_indicator_color(idx)
            tab.palette.setColor(QPalette.Base, indicator_color)
            if tab.rect.right() < 0 or tab.rect.left() > self.width():
                # Don't bother drawing a tab if the entire tab is outside of
                # the visible tab bar.
                continue
            p.drawControl(QStyle.CE_TabBarTab, tab)
 def paintEvent(self, event):
     painter = QStylePainter(self)
     painter.rotate(self.buttonRotation)
     if self.buttonRotation == VerticalRotation.left_side:
         painter.translate(-1 * self.height(), 0)
     elif self.buttonRotation == VerticalRotation.right_side:
         painter.translate(0, -1 * self.width())
     painter.drawControl(QStyle.CE_PushButton, self.getSyleOptions())
Exemplo n.º 14
0
 def paintEvent(self, event):
     if self.__flat:
         opt = QStyleOptionToolButton()
         self.initStyleOption(opt)
         p = QStylePainter(self)
         p.drawControl(QStyle.CE_ToolButtonLabel, opt)
     else:
         QToolButton.paintEvent(self, event)
Exemplo n.º 15
0
 def paintEvent(self, event):
     """绘制事件"""
     painter = QStylePainter(self.clazz)
     width = self.clazz.width() / 2
     height = self.clazz.height() / 2
     if self.direction in ("clockwise", "anticlockwise"):
         painter.translate(width, height)    # 设置中心为旋转的中心
         painter.rotate(self.rotate)
         painter.translate(-width, -height)    # 将原点复位
     painter.drawControl(self.getControlElement(), self.getSyleOptions())
Exemplo n.º 16
0
	def paintEvent(self, event):
		painter = QStylePainter(self)
		option = QStyleOptionTab()

		#painter.begin(self)
		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, Qt.AlignVCenter | Qt.TextDontClip, self.tabText(index))
Exemplo n.º 17
0
    def paintEvent(self, event):
        painter = QStylePainter(self)
        opt = QStyleOptionTab()

        for i in range(self.count()):
            self.initStyleOption(opt, i)
            key, name = opt.text.split(':')
            if key in self.mColors:
                opt.text = name
                opt.palette.setColor(QPalette.Button, self.mColors[key])
            painter.drawControl(QStyle.CE_TabBarTabShape, opt)
            painter.drawControl(QStyle.CE_TabBarTabLabel, opt)
Exemplo n.º 18
0
 def paintEvent(self, event):
     p = QStylePainter(self)
     p.rotate(90)
     p.translate(0, - self.width())
     opt = QStyleOptionButton()
     opt.initFrom(self)
     opt.text = self.text()
     if self.isChecked():
         opt.state |= QStyle.State_On
     s = opt.rect.size().transposed()
     opt.rect.setSize(s)
     p.drawControl(QStyle.CE_PushButton, opt)
Exemplo n.º 19
0
 def paintEvent(self, event):
     p = QStylePainter(self)
     p.rotate(90)
     p.translate(0, -self.width())
     opt = QStyleOptionButton()
     opt.initFrom(self)
     opt.text = self.text()
     if self.isChecked():
         opt.state |= QStyle.State_On
     s = opt.rect.size().transposed()
     opt.rect.setSize(s)
     p.drawControl(QStyle.CE_PushButton, opt)
Exemplo n.º 20
0
    def paintEvent(self, event):
        opt = QStyleOptionToolButton()
        self.initStyleOption(opt)
        if self.__showMenuIndicator and self.isChecked():
            opt.features |= QStyleOptionToolButton.HasMenu
        if self.__flat:
            # Use default widget background/border styling.
            StyledWidget_paintEvent(self, event)

            p = QStylePainter(self)
            p.drawControl(QStyle.CE_ToolButtonLabel, opt)
        else:
            p = QStylePainter(self)
            p.drawComplexControl(QStyle.CC_ToolButton, opt)
Exemplo n.º 21
0
def paintEvent(self, event):
    painter = QStylePainter(self)
    if self.orientation == 'west':
        # 设置中心为旋转的中心
        painter.translate(self.width() / 2, self.height() / 2)
        painter.rotate(90)
        # 将原点复位
        painter.translate(-self.width() / 2, -self.height() / 2)
        # painter.translate(0, -1 * self.width())
    elif self.orientation == 'east':
        painter.rotate(270)
        # painter.translate(-1 * self.height(), 0)
    else:
        raise TypeError
    painter.drawControl(QStyle.CE_PushButton, self.getSyleOptions())
Exemplo n.º 22
0
 def paintEvent(self, event):
     painter = QStylePainter(self)
     
     opt = QStyleOptionComboBox()
     self.initStyleOption(opt)
     
     selected = []
     
     for index in range(self.__model.rowCount()):
         item = self.__model.item(index)
         if item.checkState() == Qt.Checked:
             selected.append(item.text())
     
     opt.currentText = " | ".join(selected)
     
     painter.drawComplexControl(QStyle.CC_ComboBox, opt)
     painter.drawControl(QStyle.CE_ComboBoxLabel, opt)
Exemplo n.º 23
0
    def paintEvent(self, event):
        """Reimplemented."""
        painter = QStylePainter(self)
        option = QStyleOptionComboBox()
        self.initStyleOption(option)
        painter.drawComplexControl(QStyle.CC_ComboBox, option)
        # draw the icon and text
        checked = self.checkedIndices()
        if checked:
            items = [self.itemText(i) for i in checked]
            option.currentText = self.__separator.join(items)
        else:
            option.currentText = self.__placeholderText
            option.palette.setCurrentColorGroup(QPalette.Disabled)

        option.currentIcon = QIcon()
        painter.drawControl(QStyle.CE_ComboBoxLabel, option)
Exemplo n.º 24
0
    def paintEvent(self, e):
        painter = QStylePainter(self)
        painter.setPen(self.palette().color(QPalette.Text))

        opt = QStyleOptionComboBox()
        self.initStyleOption(opt)

        count = self.model().checkedCount()
        if count == 0:
            opt.currentText = self.emptyCheckText
        elif count == 3:
            opt.currentText = self.model().singleCheckText
        else:
            opt.currentText = self.fullCheckText

        painter.drawComplexControl(QStyle.CC_ComboBox, opt)

        painter.drawControl(QStyle.CE_ComboBoxLabel, opt)
Exemplo n.º 25
0
 def paintEvent(self, event):
     p = QStylePainter(self)
     q = self.parentWidget()
     if hasFeature(q, QDockWidget.DockWidgetVerticalTitleBar):
         fw = 1 or q.isFloating() and q.style().pixelMetric(
             QStyle.PM_DockWidgetFrameWidth, None, q) or 0
         mw = q.style().pixelMetric(QStyle.PM_DockWidgetTitleMargin, None,
                                    q)
         titleOpt = QStyleOptionDockWidget()
         titleOpt.initFrom(q)
         titleOpt.verticalTitleBar = True
         titleOpt.rect = QRect(
             QPoint(
                 fw, fw + mw + self.collapseButton.size().height() +
                 self.pinButton.size().height()),
             QSize(
                 self.geometry().width() - (fw * 2),
                 self.geometry().height() - (fw * 2) - mw -
                 self.collapseButton.size().height() -
                 self.pinButton.size().height()))
         titleOpt.title = q.windowTitle()
         titleOpt.closable = hasFeature(q, QDockWidget.DockWidgetClosable)
         titleOpt.floatable = hasFeature(q, QDockWidget.DockWidgetFloatable)
         p.drawControl(QStyle.CE_DockWidgetTitle, titleOpt)
     else:
         fw = q.isFloating() and q.style().pixelMetric(
             QStyle.PM_DockWidgetFrameWidth, None, q) or 0
         mw = q.style().pixelMetric(QStyle.PM_DockWidgetTitleMargin, None,
                                    q)
         titleOpt = QStyleOptionDockWidget()
         titleOpt.initFrom(q)
         titleOpt.rect = QRect(
             QPoint(
                 fw + mw + self.collapseButton.size().width() +
                 self.pinButton.size().width(), fw),
             QSize(
                 self.geometry().width() - (fw * 2) - mw -
                 self.collapseButton.size().width() -
                 self.pinButton.size().width(),
                 self.geometry().height() - (fw * 2)))
         titleOpt.title = q.windowTitle()
         titleOpt.closable = hasFeature(q, QDockWidget.DockWidgetClosable)
         titleOpt.floatable = hasFeature(q, QDockWidget.DockWidgetFloatable)
         p.drawControl(QStyle.CE_DockWidgetTitle, titleOpt)
Exemplo n.º 26
0
 def eventFilter(self, obj, event):
     if event.type() != QEvent.Paint or not isinstance(
             obj, QAbstractButton):
         return False
     option: QStyleOptionHeader = QStyleOptionHeader()
     option.initFrom(obj)
     style_state = QStyle.State_None
     if obj.isEnabled():
         style_state |= QStyle.State_Enabled
     if obj.isActiveWindow():
         style_state |= QStyle.State_Active
     if obj.isDown():
         style_state |= QStyle.State_Sunken
     option.state = style_state
     option.rect = obj.rect()
     option.text = obj.text()
     option.position = QStyleOptionHeader.OnlyOneSection
     painter = QStylePainter(obj)
     painter.drawControl(QStyle.CE_Header, option)
     return True
Exemplo n.º 27
0
 def paintEvent(self, event):
     '''绘制事件'''
     if not self._timer.isActive():
         return super(LinkButton, self).paintEvent(event)
     if self._direction in ("clockwise", "anticlockwise"):
         option = QStyleOptionButton()
         self.initStyleOption(option)
         option.text = ""  # 不让其绘制文字
         painter = QStylePainter(self)
         painter.drawControl(QStyle.CE_PushButton, option)
         # 变换坐标为正中间
         painter.translate(self.rect().center())
         painter.rotate(self._rotate)  # 旋转
         fm = self.fontMetrics()
         # 在变换坐标后的正中间画文字
         w = fm.width(self.text())
         h = fm.height()
         painter.drawText(QRectF(0 - w * 2, 0 - h, w * 2 * 2, h * 2),
                          Qt.AlignCenter, self.text())
         return
     super(LinkButton, self).paintEvent(event)
Exemplo n.º 28
0
    def paintEvent(self, event):
        painter = QStylePainter(self)
        opt = QStyleOptionTab()

        for i in range(self.count()):
            self.initStyleOption(opt, i)
            painter.drawControl(QStyle.CE_TabBarTabShape, opt)
            painter.save()

            s = opt.rect.size()
            s.transpose()
            r = QRect(QPoint(), s)
            r.moveCenter(opt.rect.center())
            opt.rect = r

            c = self.tabRect(i).center()
            painter.translate(c)
            painter.rotate(270)
            painter.translate(-c)
            painter.drawControl(QStyle.CE_TabBarTabLabel, opt)
            painter.restore()
Exemplo n.º 29
0
    def paintEvent(self, _e):
        """Override paintEvent to draw the tabs like we want to."""
        # pylint: disable=bad-config-call
        # WORKAROUND for https://bitbucket.org/logilab/astroid/issue/104
        p = QStylePainter(self)
        selected = self.currentIndex()
        for idx in range(self.count()):
            tab = QStyleOptionTab()
            self.initStyleOption(tab, idx)

            bg_parts = ["tabs", "bg"]
            fg_parts = ["tabs", "fg"]
            if idx == selected:
                bg_parts.append("selected")
                fg_parts.append("selected")

            if idx % 2:
                bg_parts.append("odd")
                fg_parts.append("odd")
            else:
                bg_parts.append("even")
                fg_parts.append("even")

            bg_color = config.get("colors", ".".join(bg_parts))
            fg_color = config.get("colors", ".".join(fg_parts))
            tab.palette.setColor(QPalette.Window, bg_color)
            tab.palette.setColor(QPalette.WindowText, fg_color)

            try:
                indicator_color = self.tab_data(idx, "indicator-color")
            except KeyError:
                indicator_color = QColor()
            tab.palette.setColor(QPalette.Base, indicator_color)
            if tab.rect.right() < 0 or tab.rect.left() > self.width():
                # Don't bother drawing a tab if the entire tab is outside of
                # the visible tab bar.
                continue
            p.drawControl(QStyle.CE_TabBarTab, tab)
Exemplo n.º 30
0
 def paintEvent(self, event: QPaintEvent):
     painter = QStylePainter(self)
     if self.orientation == self.Vertical:
         painter.rotate(270)
         painter.translate(-1 * self.height(), 0)
     painter.drawControl(QStyle.CE_PushButton, self.getStyleOptions())