当前位置: 首页>>代码示例>>Python>>正文


Python QApplication.style方法代码示例

本文整理汇总了Python中spyderlib.qt.QtGui.QApplication.style方法的典型用法代码示例。如果您正苦于以下问题:Python QApplication.style方法的具体用法?Python QApplication.style怎么用?Python QApplication.style使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在spyderlib.qt.QtGui.QApplication的用法示例。


在下文中一共展示了QApplication.style方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: paintEvent

# 需要导入模块: from spyderlib.qt.QtGui import QApplication [as 别名]
# 或者: from spyderlib.qt.QtGui.QApplication import style [as 别名]
    def paintEvent(self, event):
        """Qt Override.

        Include a validation icon to the left of the line edit.
        """
        super(IconLineEdit, self).paintEvent(event)
        painter = QPainter(self)

        rect = self.geometry()
        space = int((rect.height())/6)
        h = rect.height() - space
        w = rect.width() - h

        if self._icon_visible:
            if self._status and self._status_set:
                pixmap = self._set_icon.pixmap(h, h)
            elif self._status:
                pixmap = self._valid_icon.pixmap(h, h)
            else:
                pixmap = self._invalid_icon.pixmap(h, h)

            painter.drawPixmap(w, space, pixmap)

        application_style = QApplication.style().objectName()
        if self._application_style != application_style:
            self._application_style = application_style
            self._refresh()

        # Small hack to gurantee correct padding on Spyder start
        if self._paint_count < 5:
            self._paint_count += 1
            self._refresh()
开发者ID:AminJamalzadeh,项目名称:spyder,代码行数:34,代码来源:helperwidgets.py

示例2: paint

# 需要导入模块: from spyderlib.qt.QtGui import QApplication [as 别名]
# 或者: from spyderlib.qt.QtGui.QApplication import style [as 别名]
    def paint(self, painter, option, index):
        options = QStyleOptionViewItem(option)
        self.initStyleOption(options, index)

        style = (QApplication.style() if options.widget is None
                 else options.widget.style())

        doc = QTextDocument()
        doc.setDocumentMargin(self._margin)
        doc.setHtml(options.text)

        options.text = ""
        style.drawControl(QStyle.CE_ItemViewItem, options, painter)

        ctx = QAbstractTextDocumentLayout.PaintContext()

        textRect = style.subElementRect(QStyle.SE_ItemViewItemText, options)
        painter.save()
        if style.objectName() == 'oxygen':
            painter.translate(textRect.topLeft() + QPoint(5, -9))
        else:
            painter.translate(textRect.topLeft())
            painter.setClipRect(textRect.translated(-textRect.topLeft()))
        doc.documentLayout().draw(painter, ctx)

        painter.restore()
开发者ID:AminJamalzadeh,项目名称:spyder,代码行数:28,代码来源:helperwidgets.py

示例3: __init__

# 需要导入模块: from spyderlib.qt.QtGui import QApplication [as 别名]
# 或者: from spyderlib.qt.QtGui.QApplication import style [as 别名]
    def __init__(self, *args, **kwargs):
        super(IconLineEdit, self).__init__(*args, **kwargs)

        self._status = True
        self._status_set = True
        self._valid_icon = ima.icon('todo')
        self._invalid_icon = ima.icon('warning')
        self._set_icon = ima.icon('todo_list')
        self._application_style = QApplication.style().objectName()
        self._refresh()
        self._paint_count = 0
        self._icon_visible = False
开发者ID:AminJamalzadeh,项目名称:spyder,代码行数:14,代码来源:helperwidgets.py


注:本文中的spyderlib.qt.QtGui.QApplication.style方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。