本文整理汇总了Python中PyQt5.QtGui.QBrush.color方法的典型用法代码示例。如果您正苦于以下问题:Python QBrush.color方法的具体用法?Python QBrush.color怎么用?Python QBrush.color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QBrush
的用法示例。
在下文中一共展示了QBrush.color方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __set_brushAlpha
# 需要导入模块: from PyQt5.QtGui import QBrush [as 别名]
# 或者: from PyQt5.QtGui.QBrush import color [as 别名]
def __set_brushAlpha(self, alpha: int):
"""
Args:
alpha: Description
"""
brush = QBrush(self.item.brush())
color = QColor(brush.color())
color.setAlpha(alpha)
self.item.setBrush(QBrush(color))
示例2: __set_brushAlpha
# 需要导入模块: from PyQt5.QtGui import QBrush [as 别名]
# 或者: from PyQt5.QtGui.QBrush import color [as 别名]
def __set_brushAlpha(self, alpha):
"""Summary
Args:
alpha (TYPE): Description
Returns:
TYPE: Description
"""
brush = QBrush(self.item.brush())
color = QColor(brush.color())
color.setAlpha(alpha)
self.item.setBrush(QBrush(color))
示例3: BrushFormation
# 需要导入模块: from PyQt5.QtGui import QBrush [as 别名]
# 或者: from PyQt5.QtGui.QBrush import color [as 别名]
class BrushFormation(InstrumentFormation):
''' Specialize to Qt <QBrush> '''
def __init__(self, parentSelector, role=""):
InstrumentFormation.__init__(self, name="Brush", parentSelector=parentSelector, role=role)
self.instrument = QBrush()
self.styleProperties=[BaseStyleProperty("Color", self.instrument.setColor, self.selector,
resettableValueFactory=ResettableColorValue,
layoutFactory=ColorStylePropertyLayout,
default=self.instrument.color()),
BaseStyleProperty("Style", # Was Pattern
self.instrument.setStyle, self.selector,
default=self.instrument.style(),
# ResettableIntValue defaults and works
layoutFactory=ComboBoxStylePropertyLayout,
domainModel = config.BrushModel),]
'''
sic, BrushPattern is called Style in Qt
Need Pattern, since defaults to NoBrush and that means color is moot.
If we just have Color, once it is set, no way to go back to unfilled.
TODO: user friendly: if user chooses color, ensure pattern is not NoBrush
'''
# TODO gradients and texture not working?
def applyTo(self, morph):
#print "setBrush on morph", self.instrument.color()
# Morph knows it's scale and applies it to self instrument
morph.scaleInstrument(self.instrument) # No baseValue, defaults to 1
# Tell Morph to use self.instrument to draw itself
morph.setBrush(self.instrument)
"""