本文整理汇总了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()
示例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()
示例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