当前位置: 首页>>代码示例>>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;未经允许,请勿转载。