本文整理汇总了Python中PyQt5.QtGui.QBrush.setStyle方法的典型用法代码示例。如果您正苦于以下问题:Python QBrush.setStyle方法的具体用法?Python QBrush.setStyle怎么用?Python QBrush.setStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QBrush
的用法示例。
在下文中一共展示了QBrush.setStyle方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtGui import QBrush [as 别名]
# 或者: from PyQt5.QtGui.QBrush import setStyle [as 别名]
def __init__(self, parent = None, message = None, itemType = "log"):
QListWidgetItem.__init__(self)
self.itemType = itemType
if (itemType == "log"):
self.setText("--- " + str(message))
elif (itemType == "in"):
self.setText("<<< " + str(message))
elif (itemType == "out"):
self.setText(">>> " + str(message))
else:
self.setText(str(message))
font = QFont()
font.setFamily("Monospace")
if (itemType == "in") or (itemType == "out"):
font.setBold(True)
font.setWeight(75)
else:
font.setBold(False)
font.setWeight(50)
self.setFont(font)
brush = QBrush(QColor(0, 0, 0))
if (itemType == "in"):
brush = QBrush(QColor(0, 0, 85))
elif (itemType == "out"):
brush = QBrush(QColor(0, 85, 0))
brush.setStyle(Qt.NoBrush)
self.setForeground(brush)
示例2: setStyle
# 需要导入模块: from PyQt5.QtGui import QBrush [as 别名]
# 或者: from PyQt5.QtGui.QBrush import setStyle [as 别名]
def setStyle(self, painter, fillColor, penColor, stroke):
brush = QBrush()
pen = QPen(penColor, stroke)
brush.setColor(fillColor)
brush.setStyle(Qt.SolidPattern)
painter.setBrush(brush)
painter.setPen(pen)
painter.setRenderHint(QPainter.Antialiasing)
示例3: paintEvent
# 需要导入模块: from PyQt5.QtGui import QBrush [as 别名]
# 或者: from PyQt5.QtGui.QBrush import setStyle [as 别名]
def paintEvent(self, ev):
pen = QPen()
pen.setStyle(Qt.DotLine)
pen.setWidth(2)
pen.setColor(QColor(Qt.white))
brush = QBrush()
brush.setStyle(Qt.SolidPattern)
brush.setColor(QColor(0, 0, 0))
painter = QPainter(self)
painter.setPen(pen)
painter.setBrush(brush)
painter.drawRect(ev.rect())
示例4: drawShape
# 需要导入模块: from PyQt5.QtGui import QBrush [as 别名]
# 或者: from PyQt5.QtGui.QBrush import setStyle [as 别名]
def drawShape(self, event, qp):
pen = QPen(Qt.yellow)
pen.setWidth(3)
# rellenar fondo con patron de imagen
brush = QBrush()
brush.setTexture(QPixmap('image/small_image.jpg'))
# establecer el QBrush
qp.setBrush(brush)
qp.setPen(pen)
qp.drawRoundedRect(QRect(50, 50, 200, 150), 15, 15)
# utilizar un patron predefinido
brush.setStyle(Qt.DiagCrossPattern)
qp.setBrush(brush)
qp.drawEllipse(350, 50, 150, 150)
示例5: getLogger
# 需要导入模块: from PyQt5.QtGui import QBrush [as 别名]
# 或者: from PyQt5.QtGui.QBrush import setStyle [as 别名]
QGraphicsScene,
QGraphicsView,
QGroupBox,
QVBoxLayout,
)
from .settings import Config, FormInt
from .utils import convert_name_to_color, LINE_WIDTH
lg = getLogger(__name__)
NoPen = QPen()
NoPen.setStyle(Qt.NoPen)
NoBrush = QBrush()
NoBrush.setStyle(Qt.NoBrush)
STAGES = {'Wake': {'pos0': 5, 'pos1': 25, 'color': Qt.black},
'Movement': {'pos0': 5, 'pos1': 25, 'color': Qt.darkGray},
'REM': {'pos0': 10, 'pos1': 20, 'color': Qt.magenta},
'NREM1': {'pos0': 15, 'pos1': 15, 'color': Qt.cyan},
'NREM2': {'pos0': 20, 'pos1': 10, 'color': Qt.blue},
'NREM3': {'pos0': 25, 'pos1': 5, 'color': Qt.darkBlue},
'Undefined': {'pos0': 0, 'pos1': 30, 'color': Qt.gray},
'Unknown': {'pos0': 30, 'pos1': 0, 'color': NoBrush},
}
BARS = {'markers': {'pos0': 15, 'pos1': 10, 'tip': 'Markers in Dataset'},
'annot': {'pos0': 30, 'pos1': 10,
'tip': 'Annotations (bookmarks and events)'},
'stage': {'pos0': 45, 'pos1': 30, 'tip': 'Sleep Stage'},
示例6: drawBrushes
# 需要导入模块: from PyQt5.QtGui import QBrush [as 别名]
# 或者: from PyQt5.QtGui.QBrush import setStyle [as 别名]
def drawBrushes(self, qp):
brush = QBrush(Qt.SolidPattern)
qp.setBrush(brush)
qp.drawRect(10, 15, 90, 60)
brush.setStyle(Qt.Dense1Pattern)
qp.setBrush(brush)
qp.drawRect(130, 15, 90, 60)
brush.setStyle(Qt.Dense2Pattern)
qp.setBrush(brush)
qp.drawRect(250, 15, 90, 60)
brush.setStyle(Qt.Dense3Pattern)
qp.setBrush(brush)
qp.drawRect(10, 105, 90, 60)
brush.setStyle(Qt.DiagCrossPattern)
qp.setBrush(brush)
qp.drawRect(10, 105, 90, 60)
brush.setStyle(Qt.Dense5Pattern)
qp.setBrush(brush)
qp.drawRect(130, 105, 90, 60)
brush.setStyle(Qt.Dense6Pattern)
qp.setBrush(brush)
qp.drawRect(250, 105, 90, 60)
brush.setStyle(Qt.HorPattern)
qp.setBrush(brush)
qp.drawRect(10, 195, 90, 60)
brush.setStyle(Qt.VerPattern)
qp.setBrush(brush)
qp.drawRect(130, 195, 90, 60)
brush.setStyle(Qt.BDiagPattern)
qp.setBrush(brush)
qp.drawRect(250, 195, 90, 60)
示例7: QBrush
# 需要导入模块: from PyQt5.QtGui import QBrush [as 别名]
# 或者: from PyQt5.QtGui.QBrush import setStyle [as 别名]
from pyqtgraph.functions import mkPen
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QColor, QBrush
# TODO: Pick color scheme
# RPE Table
_RPE_IDEAL_ALPHA = 140
_RPE_UNDESIRABLE_ALPHA = 120
RpeBrushIdeal = QBrush(QColor(255, 255, 0, _RPE_IDEAL_ALPHA))
RpeBrushIdeal.setStyle(Qt.SolidPattern)
RpeBrushUndesirable = QBrush(QColor(255, 0, 0, _RPE_UNDESIRABLE_ALPHA))
RpeBrushUndesirable.setStyle(Qt.SolidPattern)
bw_color_cols = ['Diff', 'Goal_Diff']
BW_TABLE_ALPHA = 120
LOG_START = 90
# TODO: Refactor other brushes, pick color scheme
green_brush = QBrush(QColor(0, 255, 0, BW_TABLE_ALPHA))
green_brush.setStyle(Qt.SolidPattern)
red_brush = QBrush(QColor(255, 0, 0, BW_TABLE_ALPHA))
red_brush.setStyle(Qt.SolidPattern)
blue_brush = QBrush(QColor(0, 0, 255, 120))
blue_brush.setStyle(Qt.SolidPattern)
gray_brush = QBrush(QColor(200, 200, 200, 70))
gray_brush.setStyle(Qt.SolidPattern)