def pressedCalendarButton(self): try: calendarButtonCurrentGeometry = QtCore.QRect( self.calendarToolButton.geometry()) calendarButtonAnimation = QPropertyAnimation( self.calendarToolButton, 'geometry'.encode(encoding='utf_8')) calendarButtonAnimation.setDuration(self.ANIMATIONDURATION) calendarButtonAnimation.setStartValue( calendarButtonCurrentGeometry) calendarWidgetCurrentGeometry = QtCore.QRect( self.calendarWidget.geometry()) calendarWidgetAnimation = QPropertyAnimation( self.calendarWidget, 'geometry'.encode(encoding='utf_8')) calendarWidgetAnimation.setDuration(self.ANIMATIONDURATION) calendarWidgetAnimation.setStartValue( calendarWidgetCurrentGeometry) if self.CalendarCurrentState == 'Closed': calendarButtonEndTopLeftCorner = QtCore.QPoint( self.calendarToolButton.pos() - QtCore.QPoint(275, 0)) calendarWidgetEndTopLeftCorner = QtCore.QPoint( self.calendarWidget.pos() - QtCore.QPoint(275, 0)) self.CalendarCurrentState = 'Open' self.Calendar = Calendar() self.calendarLabel.setText(self.Calendar.EventList) else: calendarButtonEndTopLeftCorner = QtCore.QPoint( self.calendarToolButton.pos() + QtCore.QPoint(275, 0)) calendarWidgetEndTopLeftCorner = QtCore.QPoint( self.calendarWidget.pos() + QtCore.QPoint(275, 0)) self.CalendarCurrentState = 'Closed' calendarButtonFinalGeometry = QtCore.QRect( calendarButtonEndTopLeftCorner, QtCore.QSize(self.calendarToolButton.width(), self.calendarToolButton.height())) calendarButtonAnimation.setEndValue(calendarButtonFinalGeometry) calendarWidgetFinalGeometry = QtCore.QRect( calendarWidgetEndTopLeftCorner, QtCore.QSize(self.calendarWidget.width(), self.calendarWidget.height())) calendarWidgetAnimation.setEndValue(calendarWidgetFinalGeometry) calendarButtonAnimation.start() calendarWidgetAnimation.start() #self.setcalendarWidgetStyleSheet() self.CalendarIconAnimation = calendarButtonAnimation self.CalendarWidgetAnimation = calendarWidgetAnimation except Exception as e: print(e.strerror)
def pressedPandoraButton(self): pandoraButtonCurrentGeometry = QtCore.QRect( self.pandoraToolButton.geometry()) pandoraButtonAnimation = QPropertyAnimation( self.pandoraToolButton, 'geometry'.encode(encoding='utf_8')) pandoraButtonAnimation.setDuration(self.ANIMATIONDURATION) pandoraButtonAnimation.setStartValue(pandoraButtonCurrentGeometry) pandoraWidgetCurrentGeometry = QtCore.QRect( self.pandoraWidget.geometry()) pandoraWidgetAnimation = QPropertyAnimation( self.pandoraWidget, 'geometry'.encode(encoding='utf_8')) pandoraWidgetAnimation.setDuration(self.ANIMATIONDURATION) pandoraWidgetAnimation.setStartValue(pandoraWidgetCurrentGeometry) if self.PandoraCurrentState == 'Closed': pandoraButtonEndTopLeftCorner = QtCore.QPoint( self.pandoraToolButton.pos() - QtCore.QPoint(275, 0)) pandoraWidgetEndTopLeftCorner = QtCore.QPoint( self.pandoraWidget.pos() - QtCore.QPoint(275, 0)) self.PandoraCurrentState = 'Open' if self.Pandora.started == True: self.playToolButton.hide() self.pauseToolButton.show() else: pandoraButtonEndTopLeftCorner = QtCore.QPoint( self.pandoraToolButton.pos() + QtCore.QPoint(275, 0)) pandoraWidgetEndTopLeftCorner = QtCore.QPoint( self.pandoraWidget.pos() + QtCore.QPoint(275, 0)) self.PandoraCurrentState = 'Closed' pandoraButtonFinalGeometry = QtCore.QRect( pandoraButtonEndTopLeftCorner, QtCore.QSize(self.pandoraToolButton.width(), self.pandoraToolButton.height())) pandoraButtonAnimation.setEndValue(pandoraButtonFinalGeometry) pandoraWidgetFinalGeometry = QtCore.QRect( pandoraWidgetEndTopLeftCorner, QtCore.QSize(self.pandoraWidget.width(), self.pandoraWidget.height())) pandoraWidgetAnimation.setEndValue(pandoraWidgetFinalGeometry) pandoraButtonAnimation.start() pandoraWidgetAnimation.start() #self.setpandoraWidgetStyleSheet() self.PandoraIconAnimation = pandoraButtonAnimation self.PandoraWidgetAnimation = pandoraWidgetAnimation
def pressedAlarmButton(self): try: alarmButtonCurrentGeometry = QtCore.QRect( self.alarmToolButton.geometry()) alarmButtonAnimation = QPropertyAnimation( self.alarmToolButton, 'geometry'.encode(encoding='utf_8')) alarmButtonAnimation.setDuration(self.ANIMATIONDURATION) alarmButtonAnimation.setStartValue(alarmButtonCurrentGeometry) alarmWidgetCurrentGeometry = QtCore.QRect( self.alarmWidget.geometry()) alarmWidgetAnimation = QPropertyAnimation( self.alarmWidget, 'geometry'.encode(encoding='utf_8')) alarmWidgetAnimation.setDuration(self.ANIMATIONDURATION) alarmWidgetAnimation.setStartValue(alarmWidgetCurrentGeometry) if self.AlarmCurrentState == 'Closed': alarmButtonEndTopLeftCorner = QtCore.QPoint( self.alarmToolButton.pos() - QtCore.QPoint(275, 0)) alarmWidgetEndTopLeftCorner = QtCore.QPoint( self.alarmWidget.pos() - QtCore.QPoint(275, 0)) self.AlarmCurrentState = 'Open' else: alarmButtonEndTopLeftCorner = QtCore.QPoint( self.alarmToolButton.pos() + QtCore.QPoint(275, 0)) alarmWidgetEndTopLeftCorner = QtCore.QPoint( self.alarmWidget.pos() + QtCore.QPoint(275, 0)) self.AlarmCurrentState = 'Closed' alarmButtonFinalGeometry = QtCore.QRect( alarmButtonEndTopLeftCorner, QtCore.QSize(self.alarmToolButton.width(), self.alarmToolButton.height())) alarmButtonAnimation.setEndValue(alarmButtonFinalGeometry) alarmWidgetFinalGeometry = QtCore.QRect( alarmWidgetEndTopLeftCorner, QtCore.QSize(self.alarmWidget.width(), self.alarmWidget.height())) alarmWidgetAnimation.setEndValue(alarmWidgetFinalGeometry) alarmButtonAnimation.start() alarmWidgetAnimation.start() #self.setAlarmWidgetStyleSheet() self.AlarmIconAnimation = alarmButtonAnimation self.AlarmWidgetAnimation = alarmWidgetAnimation except Exception as e: print(e.strerror)
def __init__(self, gui): QWidget.__init__(self, gui) self.setObjectName('jobs_pointer') self.setVisible(False) self.resize(100, 80) self.animation = QPropertyAnimation(self, "geometry", self) self.animation.setDuration(750) self.animation.setLoopCount(2) self.animation.setEasingCurve(QEasingCurve.Linear) self.animation.finished.connect(self.hide) taily, heady = 0, 55 self.arrow_path = QPainterPath(QPointF(40, taily)) self.arrow_path.lineTo(40, heady) self.arrow_path.lineTo(20, heady) self.arrow_path.lineTo(50, self.height()) self.arrow_path.lineTo(80, heady) self.arrow_path.lineTo(60, heady) self.arrow_path.lineTo(60, taily) self.arrow_path.closeSubpath() c = self.palette().color(QPalette.Active, QPalette.WindowText) self.color = QColor(c) self.color.setAlpha(100) self.brush = QBrush(self.color, Qt.SolidPattern)
def __init__(self, icon, title, parent, size=None, padding=None, color=None, hover_color=None): QPushButton.__init__(self, parent) self._theme_manager = ThemeManager.get(self) self._background_color = hover_color or self._theme_manager.get_color( 'button_background_hover') self.setToolTip(title) self._icon = Icon(self, icon, size, padding, color) self._iconname = icon self._layout = QHBoxLayout(self) self._layout.addWidget(self._icon) self._layout.setContentsMargins(0, 0, 0, 0) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self._size = size self.setFlat(True) self._background_opacity = 0.0 self._background_opacity_stop = 0.0 self._update_style_sheet() self._animation = QPropertyAnimation(self, b'backgroundOpacity') self.clicked.connect(self._update_background_opacity_stop)
def __init__(self, *args): QToolButton.__init__(self, *args) self.animation = QPropertyAnimation(self, 'iconSize', self) self.animation.setDuration(60 / 72. * 1000) self.animation.setLoopCount(4) self.normal_icon_size = QSize(64, 64) self.animation.valueChanged.connect(self.value_changed) self.setCursor(Qt.PointingHandCursor) self.animation.finished.connect(self.animation_finished)
def __init__(self, parent): QWidget.__init__(self, parent) self.setVisible(False) self._animated_size = 1.0 self.animation = QPropertyAnimation(self, b'animated_size', self) self.animation.setEasingCurve(QEasingCurve.Linear) self.animation.setDuration(1000), self.animation.setStartValue(0.0), self.animation.setEndValue(1.0) self.animation.valueChanged.connect(self.animation_value_changed) self.animation.finished.connect(self.animation_done)
def __init__(self, parent): QWidget.__init__(self, parent) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.set_icon('dialog_question.png') self.default_icon = self.icon self._fraction = 0.0 self.animation = a = QPropertyAnimation(self, b"fraction", self) a.setDuration(2000), a.setEasingCurve(QEasingCurve.Linear) a.setStartValue(0.0), a.setEndValue(2.0), a.setLoopCount(10)
def __init__(self, *args): QToolButton.__init__(self, *args) self._icon_size = -1 QToolButton.setIcon(self, QIcon(I('donate.png'))) self.setText('\xa0') self.animation = QPropertyAnimation(self, b'icon_size', self) self.animation.setDuration(60/72.*1000) self.animation.setLoopCount(4) self.animation.valueChanged.connect(self.value_changed) self.setCursor(Qt.PointingHandCursor) self.animation.finished.connect(self.animation_finished)
def __init__(self, parent): super(CoverDelegate, self).__init__(parent) self._animated_size = 1.0 self.animation = QPropertyAnimation(self, b'animated_size', self) self.animation.setEasingCurve(QEasingCurve.OutInCirc) self.animation.setDuration(500) self.set_dimensions() self.cover_cache = CoverCache() self.render_queue = LifoQueue() self.animating = None self.highlight_color = QColor(Qt.white)
def __init__(self, parent): QWidget.__init__(self, parent) self.setGeometry(0, 0, 1, 1) self._current_width = 0 self.before_image = self.after_image = None self.animation = QPropertyAnimation(self, b'current_width', self) self.setVisible(False) self.animation.valueChanged.connect(self.update) self.animation.finished.connect(self.finished) self.flip_forwards = True self.setAttribute(Qt.WA_OpaquePaintEvent)
def show_error(self): # 窗体抖动效果 animation = QPropertyAnimation(self) animation.setTargetObject(self) animation.setPropertyName(b'pos') animation.setKeyValueAt(0, self.pos()) animation.setKeyValueAt(0.2, self.pos() + QPoint(15, 0)) animation.setKeyValueAt(0.5, self.pos()) animation.setKeyValueAt(0.7, self.pos() + QPoint(-15, 0)) animation.setKeyValueAt(1, self.pos()) animation.setDuration(100) animation.setLoopCount(3) animation.start(QAbstractAnimation.DeleteWhenStopped)
def __init__(self, *args): QToolButton.__init__(self, *args) # vertically size policy must be expanding for it to align inside a # toolbar self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self._icon_size = -1 QToolButton.setIcon(self, QIcon(I('donate.png'))) self.setText('\xa0') self.animation = QPropertyAnimation(self, b'icon_size', self) self.animation.setDuration(60 / 72. * 1000) self.animation.setLoopCount(4) self.animation.valueChanged.connect(self.value_changed) self.setCursor(Qt.PointingHandCursor) self.animation.finished.connect(self.animation_finished)
def __init__(self, tabbar): ''' @param: tabbar QWidget ''' super().__init__(tabbar) self.icon = QIcon() self.text = '' self._animator = QPropertyAnimation() self._tabbar = tabbar # QWidget self._fader = 0.0 self._animator.setPropertyName(b'fader') self._animator.setTargetObject(self) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum)
def __init__(self, vertical, parent=None): QWidget.__init__(self, parent) self._current_pixmap_size = QSize(120, 120) self.vertical = vertical self.animation = QPropertyAnimation(self, b'current_pixmap_size', self) self.animation.setEasingCurve(QEasingCurve(QEasingCurve.OutExpo)) self.animation.setDuration(1000) self.animation.setStartValue(QSize(0, 0)) self.animation.valueChanged.connect(self.value_changed) self.setSizePolicy( QSizePolicy.Expanding if vertical else QSizePolicy.Minimum, QSizePolicy.Expanding) self.default_pixmap = QPixmap(I('default_cover.png')) self.pixmap = self.default_pixmap self.pwidth = self.pheight = None self.data = {} self.do_layout()
def __init__(self, pathtoebook=None, debug_javascript=False, open_at=None, start_in_fullscreen=False): MainWindow.__init__(self, debug_javascript) self.view.magnification_changed.connect(self.magnification_changed) self.show_toc_on_open = False self.current_book_has_toc = False self.iterator = None self.current_page = None self.pending_search = None self.pending_search_dir= None self.pending_anchor = None self.pending_reference = None self.pending_bookmark = None self.pending_restore = False self.cursor_hidden = False self.existing_bookmarks= [] self.selected_text = None self.was_maximized = False self.page_position_on_footnote_toggle = [] self.read_settings() self.pos.value_changed.connect(self.update_pos_label) self.pos.setMinimumWidth(150) self.setFocusPolicy(Qt.StrongFocus) self.view.set_manager(self) self.pi = ProgressIndicator(self) self.action_quit = QAction(_('&Quit'), self) self.addAction(self.action_quit) self.view_resized_timer = QTimer(self) self.view_resized_timer.timeout.connect(self.viewport_resize_finished) self.view_resized_timer.setSingleShot(True) self.resize_in_progress = False self.action_reload = QAction(_('&Reload book'), self) self.action_reload.triggered.connect(self.reload_book) self.action_quit.triggered.connect(self.quit) self.action_reference_mode.triggered[bool].connect(self.view.reference_mode) self.action_metadata.triggered[bool].connect(self.metadata.setVisible) self.action_table_of_contents.toggled[bool].connect(self.set_toc_visible) self.action_copy.triggered[bool].connect(self.copy) self.action_font_size_larger.triggered.connect(self.font_size_larger) self.action_font_size_smaller.triggered.connect(self.font_size_smaller) self.action_open_ebook.triggered[bool].connect(self.open_ebook) self.action_next_page.triggered.connect(self.view.next_page) self.action_previous_page.triggered.connect(self.view.previous_page) self.action_find_next.triggered.connect(self.find_next) self.action_find_previous.triggered.connect(self.find_previous) self.action_full_screen.triggered[bool].connect(self.toggle_fullscreen) self.action_back.triggered[bool].connect(self.back) self.action_forward.triggered[bool].connect(self.forward) self.action_preferences.triggered.connect(self.do_config) self.pos.editingFinished.connect(self.goto_page_num) self.vertical_scrollbar.valueChanged[int].connect(lambda x:self.goto_page(x/100.)) self.search.search.connect(self.find) self.search.focus_to_library.connect(lambda: self.view.setFocus(Qt.OtherFocusReason)) self.toc.pressed[QModelIndex].connect(self.toc_clicked) self.toc.searched.connect(partial(self.toc_clicked, force=True)) self.reference.goto.connect(self.goto) self.bookmarks.edited.connect(self.bookmarks_edited) self.bookmarks.activated.connect(self.goto_bookmark) self.bookmarks.create_requested.connect(self.bookmark) self.set_bookmarks([]) self.load_theme_menu() if pathtoebook is not None: f = functools.partial(self.load_ebook, pathtoebook, open_at=open_at) QTimer.singleShot(50, f) self.window_mode_changed = None self.toggle_toolbar_action = QAction(_('Show/hide controls'), self) self.toggle_toolbar_action.setCheckable(True) self.toggle_toolbar_action.triggered.connect(self.toggle_toolbars) self.toolbar_hidden = None self.addAction(self.toggle_toolbar_action) self.full_screen_label_anim = QPropertyAnimation( self.full_screen_label, 'size') self.clock_timer = QTimer(self) self.clock_timer.timeout.connect(self.update_clock) self.action_print.triggered.connect(self.print_book) self.print_menu.actions()[0].triggered.connect(self.print_preview) self.clear_recent_history_action = QAction( _('Clear list of recently opened books'), self) self.clear_recent_history_action.triggered.connect(self.clear_recent_history) self.build_recent_menu() self.open_history_menu.triggered.connect(self.open_recent) for x in ('tool_bar', 'tool_bar2'): x = getattr(self, x) for action in x.actions(): # So that the keyboard shortcuts for these actions will # continue to function even when the toolbars are hidden self.addAction(action) for plugin in self.view.document.all_viewer_plugins: plugin.customize_ui(self) self.view.document.settings_changed.connect(self.settings_changed) self.restore_state() self.settings_changed() self.action_toggle_paged_mode.toggled[bool].connect(self.toggle_paged_mode) if (start_in_fullscreen or self.view.document.start_in_fullscreen): self.action_full_screen.trigger() self.hide_cursor_timer = t = QTimer(self) t.setSingleShot(True), t.setInterval(3000) t.timeout.connect(self.hide_cursor) t.start()
def __init__(self, parent): QWidget.__init__(self, parent) self.setVisible(False) parent.installEventFilter(self) self._show_fraction = 0.0 self.show_animation = a = QPropertyAnimation(self, b"show_fraction", self) a.setDuration(1000), a.setEasingCurve(QEasingCurve.OutQuad) a.setStartValue(0.0), a.setEndValue(1.0) a.finished.connect(self.stop_show_animation) self.rendered_pixmap = None self.questions = [] self.icon = ic = Icon(self) self.msg_label = msg = QLabel('some random filler text') msg.setWordWrap(True) self.bb = QDialogButtonBox() self.bb.accepted.connect(self.accept) self.bb.rejected.connect(self.reject) self.log_button = self.bb.addButton(_('View log'), self.bb.ActionRole) self.log_button.setIcon(QIcon(I('debug.png'))) self.log_button.clicked.connect(self.show_log) self.copy_button = self.bb.addButton(_('&Copy to clipboard'), self.bb.ActionRole) self.copy_button.clicked.connect(self.copy_to_clipboard) self.action_button = self.bb.addButton('', self.bb.ActionRole) self.action_button.clicked.connect(self.action_clicked) self.show_det_msg = _('Show &details') self.hide_det_msg = _('Hide &details') self.det_msg_toggle = self.bb.addButton(self.show_det_msg, self.bb.ActionRole) self.det_msg_toggle.clicked.connect(self.toggle_det_msg) self.det_msg_toggle.setToolTip( _('Show detailed information about this error')) self.det_msg = PlainTextEdit(self) self.det_msg.setReadOnly(True) self.bb.setStandardButtons(self.bb.Yes | self.bb.No | self.bb.Ok) self.bb.button(self.bb.Yes).setDefault(True) self.title_label = title = QLabel('A dummy title') f = title.font() f.setBold(True) title.setFont(f) self.checkbox = QCheckBox('', self) self._l = l = QVBoxLayout(self) self._h = h = QHBoxLayout() self._v = v = QVBoxLayout() v.addWidget(title), v.addWidget(msg) h.addWidget(ic), h.addSpacing(10), h.addLayout(v), l.addLayout(h) l.addSpacing(5) l.addWidget(self.checkbox) l.addWidget(self.det_msg) l.addWidget(self.bb) self.ask_question.connect(self.do_ask_question, type=Qt.QueuedConnection) self.setFocusPolicy(Qt.NoFocus) for child in self.findChildren(QWidget): child.setFocusPolicy(Qt.NoFocus) self.setFocusProxy(self.parent()) self.resize_timer = t = QTimer(self) t.setSingleShot(True), t.setInterval(100), t.timeout.connect( self.parent_resized)
def drawControl(self, element, option, painter, widget): ''' @param: element ControlElement @param: option QStyleOption @param: painter QPainter @param: widget QWidget ''' v_opt = option if element != self.CE_TabBarTab or not isinstance( v_opt, QStyleOptionTab): QProxyStyle.drawControl(element, option, painter, widget) return rect = v_opt.rect selected = v_opt.state & self.State_Selected vertical_tabs = v_opt.shape == QTabBar.RoundedWest text = v_opt.text if selected: # background painter.save() grad = QLinearGradient(rect.topLeft(), rect.topRight()) grad.setColorAt(0, QColor(255, 255, 255, 140)) grad.setColorAt(0, QColor(255, 255, 255, 210)) painter.fillRect(rect.adjusted(0, 0, 0, -1), grad) painter.restore() # shadows painter.setPen(QColor(0, 0, 0, 110)) painter.drawLine(rect.topLeft() + QPoint(1, -1), rect.topRight() - QPoint(0, 1)) painter.drawLine(rect.bottomLeft(), rect.bottomRight()) painter.setPen(QColor(0, 0, 0, 40)) painter.drawLine(rect.topLeft(), rect.bottomLeft()) # highlights painter.setPen(QColor(255, 255, 255, 50)) painter.drawLine(rect.topLeft() + QPoint(0, -2), rect.topRight() - QPoint(0, 2)) painter.drawLine(rect.bottomLeft() + QPoint(0, 1), rect.bottomRight() + QPoint(0, 1)) painter.setPen(QColor(255, 255, 255, 40)) painter.drawLine(rect.topLeft() + QPoint(0, 0), rect.topRight()) painter.drawLine(rect.topRight() + QPoint(0, 1), rect.bottomRight() - QPoint(0, 1)) painter.drawLine(rect.bottomLeft() + QPoint(0, -1), rect.bottomRight() - QPoint(0, 1)) m = QTransform() if vertical_tabs: m = QTransform.fromTranslate(rect.left(), rect.bottom()) m.rotate(-90) else: m = QTransform.fromTranslate(rect.left(), rect.top()) draw_rect = QRect(QPoint(0, 0), m.mapRect(rect).size()) painter.save() painter.setTransform(m) icon_rect = QRect(QPoint(8, 0), v_opt.iconSize) text_rect = QRect(icon_rect.topRight() + QPoint(4, 0), draw_rect.size()) text_rect.setRight(draw_rect.width()) icon_rect.translate(0, (draw_rect.height() - icon_rect.height()) / 2) boldFont = QFont(painter.font()) boldFont.setPointSizeF(styleHelper.sidebarFontSize()) boldFont.setBold(True) painter.setFont(boldFont) painter.setPen(selected and QColor(255, 255, 255, 160) or QColor(0, 0, 0, 110)) textFlags = Qt.AlignHCenter | Qt.AlignVCenter painter.drawText(text_rect, textFlags, text) painter.setPen(selected and QColor(60, 60, 60) or styleHelper.panelTextColor()) if widget: fader_key = 'tab_' + text + '_fader' animation_key = 'tab_' + text + '_animation' tab_hover = widget.property('tab_hover') # int fader = widget.property(fader_key) # QPropertyAnimation animation = widget.property(animation_key) if not animation: mut_widget = widget fader = 0 mut_widget.setProperty(fader_key, fader) animation = QPropertyAnimation(mut_widget, fader_key, mut_widget) animation.valueChanged.connect(mut_widget.update) mut_widget.setProperty(animation_key, animation) if text == tab_hover: if animation.state( ) != QAbstractAnimation.Running and fader != 40: animation.stop() animation.setDuration(80) animation.setEndValue(40) animation.start() else: if animation.state( ) != QAbstractAnimation.Running and fader != 0: animation.stop() animation.setDuration(160) animation.setEndValue(0) animation.start() if not selected: painter.save() painter.fillRect(draw_rect, QColor(255, 255, 255, fader)) painter.setPen(QPen(QColor(255, 255, 255, fader), 1.0)) painter.drawLine( draw_rect.topLeft(), vertical_tabs and draw_rect.bottomLeft() or draw_rect.topRight()) painter.drawLine( draw_rect.bottomRight(), vertical_tabs and draw_rect.topRight() or draw_rect.bottomLeft()) painter.restore() if selected: iconMode = QIcon.Selected else: iconMode = QIcon.Normal styleHelper.drawIconWithShadow(v_opt.icon, icon_rect, painter, iconMode) painter.drawText(text_rect.translated(0, -1), textFlags, text) painter.restore()