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


Python QBrush.color方法代码示例

本文整理汇总了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))
开发者ID:cadnano,项目名称:cadnano2.5,代码行数:11,代码来源:pathextras.py

示例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))
开发者ID:hadim,项目名称:cadnano2.5,代码行数:15,代码来源:pathextras.py

示例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) 
  
  
  """
开发者ID:bootchk,项目名称:documentStyle,代码行数:42,代码来源:brushFormation.py


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