當前位置: 首頁>>代碼示例>>Python>>正文


Python QtWidgets.QStyleOption方法代碼示例

本文整理匯總了Python中PyQt5.QtWidgets.QStyleOption方法的典型用法代碼示例。如果您正苦於以下問題:Python QtWidgets.QStyleOption方法的具體用法?Python QtWidgets.QStyleOption怎麽用?Python QtWidgets.QStyleOption使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QStyleOption方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: drawPrimitive

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QStyleOption [as 別名]
def drawPrimitive(
                self,
                element: QtWidgets.QStyle.PrimitiveElement,
                option: QtWidgets.QStyleOption,
                painter: QtGui.QPainter,
                widget: QtWidgets.QWidget = None) -> None:
            """Draw a line across the entire row rather than just the column we're hovering over.
            This may not always work depending on global style - for instance I think it won't
            work on OSX."""
            if element == self.PE_IndicatorItemViewItemDrop and not option.rect.isNull():
                option_new = QtWidgets.QStyleOption(option)
                option_new.rect.setLeft(0)
                if widget:
                    option_new.rect.setRight(widget.width())
                option = option_new
            super().drawPrimitive(element, option, painter, widget) 
開發者ID:frans-fuerst,項目名稱:track,代碼行數:18,代碼來源:qreordertableview.py

示例2: paint_drop_indicator

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QStyleOption [as 別名]
def paint_drop_indicator(self, painter):
        if self.drag_active:
            opt = QStyleOption()
            opt.initFrom(self)
            opt.rect = self.drop_indicator_rect
            rect = opt.rect

            brush = QBrush(QColor(Qt.darkRed))

            if rect.height() == 0:
                pen = QPen(brush, 2, Qt.SolidLine)
                painter.setPen(pen)
                painter.drawLine(rect.topLeft(), rect.topRight())
            else:
                pen = QPen(brush, 2, Qt.SolidLine)
                painter.setPen(pen)
                painter.drawRect(rect) 
開發者ID:jopohl,項目名稱:urh,代碼行數:19,代碼來源:GeneratorTableView.py

示例3: widgetSubCheckBoxRect

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QStyleOption [as 別名]
def widgetSubCheckBoxRect(widget, option):
    """ Returns the rectangle of a check box drawn as a sub element of widget
    """
    opt = QtWidgets.QStyleOption()
    opt.initFrom(widget)
    style = widget.style()
    return style.subElementRect(QtWidgets.QStyle.SE_ViewItemCheckIndicator, opt, widget) 
開發者ID:titusjan,項目名稱:argos,代碼行數:9,代碼來源:misc.py

示例4: paintEvent

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QStyleOption [as 別名]
def paintEvent(self, event):
        opt = QStyleOption()
        opt.initFrom(self)
        p = QPainter(self)
        self.style().drawPrimitive(QStyle.PE_Widget, opt, p, self) 
開發者ID:Scille,項目名稱:parsec-cloud,代碼行數:7,代碼來源:custom_dialogs.py

示例5: paintEvent

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QStyleOption [as 別名]
def paintEvent(self, _):
        opt = QStyleOption()
        opt.initFrom(self)
        p = QPainter(self)
        self.style().drawPrimitive(QStyle.PE_Widget, opt, p, self) 
開發者ID:Scille,項目名稱:parsec-cloud,代碼行數:7,代碼來源:menu_widget.py

示例6: paintEvent

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QStyleOption [as 別名]
def paintEvent(self, paintEvent):
        """
        This is needed for the widget to pick the stylesheet.
        :type paintEvent: QPaintEvent
        """
        option = QtWidgets.QStyleOption()
        option.initFrom(self)
        painter = QtGui.QPainter(self)
        style = self.style()
        style.drawPrimitive(QtWidgets.QStyle.PE_Widget, option, painter, self) 
開發者ID:danielepantaleone,項目名稱:eddy,代碼行數:12,代碼來源:dock.py

示例7: paintEvent

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QStyleOption [as 別名]
def paintEvent(self, paintEvent):
        """
        This is needed for the widget to pick the stylesheet.
        :type paintEvent: QPaintEvent
        """
        option = QtWidgets.QStyleOption()
        option.initFrom(self)
        painter = QtGui.QPainter(self)
        style = self.style()
        style.drawPrimitive(QtWidgets.QStyle.PE_Widget, option, painter, self)

    #############################################
    #   SLOTS
    ################################# 
開發者ID:danielepantaleone,項目名稱:eddy,代碼行數:16,代碼來源:welcome.py

示例8: paintEvent

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QStyleOption [as 別名]
def paintEvent(self, paintEvent):
        """
        This is needed for the widget to pick the stylesheet.
        :type paintEvent: QPaintEvent
        """
        option = QtWidgets.QStyleOption()
        option.initFrom(self)
        painter = QtGui.QPainter(self)
        style = self.style()
        style.drawPrimitive(QtWidgets.QStyle.PE_Widget, option, painter, self)

    #############################################
    #   INTERFACE
    ################################# 
開發者ID:danielepantaleone,項目名稱:eddy,代碼行數:16,代碼來源:palette.py

示例9: paintEvent

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QStyleOption [as 別名]
def paintEvent(self, paintEvent):
        """
        This is needed for the widget to pick the stylesheet.
        :type paintEvent: QPaintEvent
        """
        option = QtWidgets.QStyleOption()
        option.initFrom(self)
        painter = QtGui.QPainter(self)
        style = self.style()
        style.drawPrimitive(QtWidgets.QStyle.PE_Widget, option, painter, self)


#############################################
#   INFO WIDGETS
################################# 
開發者ID:danielepantaleone,項目名稱:eddy,代碼行數:17,代碼來源:info.py

示例10: paintEvent

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QStyleOption [as 別名]
def paintEvent(self, event):

        opt = QtWidgets.QStyleOption()
        opt.initFrom(self)
        painter = QtGui.QPainter(self)
        self.style().drawPrimitive(QtWidgets.QStyle.PE_Widget, opt, painter,
                                   self)
        painter.end() 
開發者ID:reuterbal,項目名稱:photobooth,代碼行數:10,代碼來源:Widgets.py

示例11: paintEvent

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QStyleOption [as 別名]
def paintEvent(self, event):
        
        style_opt = QStyleOption()
        style_opt.initFrom(self)
        painter = QPainter(self)
        self.style().drawPrimitive(QStyle.PE_Widget, style_opt, painter, self) 
開發者ID:hANSIc99,項目名稱:Pythonic,代碼行數:8,代碼來源:element_iconbar.py

示例12: paintEvent

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QStyleOption [as 別名]
def paintEvent(self, event):
        # 解決QSS問題
        option = QStyleOption()
        option.initFrom(self)
        painter = QPainter(self)
        self.style().drawPrimitive(QStyle.PE_Widget, option, painter, self)
        super(CustomPaintWidget, self).paintEvent(event) 
開發者ID:PyQt5,項目名稱:PyQt,代碼行數:9,代碼來源:CustomPaintWidget.py


注:本文中的PyQt5.QtWidgets.QStyleOption方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。