本文整理汇总了Python中qtpy.QtGui.QBrush方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QBrush方法的具体用法?Python QtGui.QBrush怎么用?Python QtGui.QBrush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtGui
的用法示例。
在下文中一共展示了QtGui.QBrush方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: data_internal
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QBrush [as 别名]
def data_internal(self, index, record, role):
result = None
if role == Qt.DisplayRole:
if index.column() == self.columnCount(INVALID_INDEX) - 1:
result = record._cutelog
else:
column = self.table_header[index.column()]
if column.name == 'asctime':
result = record.asctime
elif role == Qt.SizeHintRole:
result = QSize(1, CONFIG.logger_row_height)
elif role == Qt.FontRole:
result = QFont(CONFIG.logger_table_font, CONFIG.logger_table_font_size)
elif role == Qt.ForegroundRole:
if not self.dark_theme:
result = QColor(Qt.black)
else:
result = QColor(Qt.white)
elif role == Qt.BackgroundRole:
if not self.dark_theme:
color = QColor(Qt.lightGray)
else:
color = QColor(Qt.darkGray)
result = QBrush(color, Qt.BDiagPattern)
return result
示例2: get_preview_items
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QBrush [as 别名]
def get_preview_items(self, level):
previewItem = QTableWidgetItem("Log message")
previewItem.setBackground(QBrush(level.bg, Qt.SolidPattern))
previewItem.setForeground(QBrush(level.fg, Qt.SolidPattern))
previewItemDark = QTableWidgetItem("Log message")
previewItemDark.setBackground(QBrush(level.bgDark, Qt.SolidPattern))
previewItemDark.setForeground(QBrush(level.fgDark, Qt.SolidPattern))
font = QFont(CONFIG.logger_table_font, CONFIG.logger_table_font_size)
fontDark = QFont(font)
if 'bold' in level.styles:
font.setBold(True)
if 'italic' in level.styles:
font.setItalic(True)
if 'underline' in level.styles:
font.setUnderline(True)
if 'bold' in level.stylesDark:
fontDark.setBold(True)
if 'italic' in level.stylesDark:
fontDark.setItalic(True)
if 'underline' in level.stylesDark:
fontDark.setUnderline(True)
previewItem.setFont(font)
previewItemDark.setFont(fontDark)
return previewItem, previewItemDark
示例3: setColor
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QBrush [as 别名]
def setColor(self, color):
self._color = color
self._ellipseItem.setBrush(QtGui.QBrush(self._color))
示例4: highlight
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QBrush [as 别名]
def highlight(self):
self._ellipseItem.setBrush(QtGui.QBrush(self._color.lighter()))
# make the port bigger to highlight it can accept the connection.
self._ellipseItem.setRect(
-self.__radius * 1.3,
-self.__radius * 1.3,
self.__diameter * 1.3,
self.__diameter * 1.3,
)
示例5: unhighlight
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QBrush [as 别名]
def unhighlight(self):
self._ellipseItem.setBrush(QtGui.QBrush(self._color))
self._ellipseItem.setRect(
-self.__radius,
-self.__radius,
self.__diameter,
self.__diameter,
)
# ===================
# Connection Methods
# ===================
示例6: _get_brush
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QBrush [as 别名]
def _get_brush(self, color):
""" Returns a brush for the color.
"""
result = self._brushes.get(color)
if result is None:
qcolor = self._get_color(color)
result = QtGui.QBrush(qcolor)
self._brushes[color] = result
return result
示例7: __init__
# 需要导入模块: from qtpy import QtGui [as 别名]
# 或者: from qtpy.QtGui import QBrush [as 别名]
def __init__(self, widget1, widget2, h_first, parent, show_arrow=True):
self.parent = parent
self.widget_start = widget1
self.widget_stop = widget2
self.h_first = h_first
self.show_arrow = show_arrow
self.brush = QtGui.QBrush(QtCore.Qt.black)
self.arrow = QtWidgets.QGraphicsPolygonItem()
self.arrow.setBrush(self.brush)
self.pen = QtGui.QPen(QtCore.Qt.black,
3,
QtCore.Qt.SolidLine,
QtCore.Qt.RoundCap,
QtCore.Qt.RoundJoin)
self.line1 = QtWidgets.QGraphicsLineItem()
self.line1.setPen(self.pen)
self.line2 = QtWidgets.QGraphicsLineItem()
self.line2.setPen(self.pen)
self.line1.setZValue(1)
self.line2.setZValue(1)
self.parent.scene.addItem(self.line1)
self.parent.scene.addItem(self.line2)
self.parent.scene.addItem(self.arrow)
self.adjust()