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


Python QtGui.QBrush方法代码示例

本文整理汇总了Python中PySide.QtGui.QBrush方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QBrush方法的具体用法?Python QtGui.QBrush怎么用?Python QtGui.QBrush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtGui的用法示例。


在下文中一共展示了QtGui.QBrush方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _paint_point

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QBrush [as 别名]
def _paint_point(self, painter, x, y):
        grad = QtGui.QRadialGradient(x, y, self.point_diameter/2)
        grad.setColorAt(0, QtGui.QColor(0, 0, 0, max(self.point_strength, 0)))
        grad.setColorAt(1, QtGui.QColor(0, 0, 0, 0))
        brush = QtGui.QBrush(grad)
        painter.setBrush(brush)
        painter.drawEllipse(
            x - self.point_diameter/2,
            y - self.point_diameter/2,
            self.point_diameter,
            self.point_diameter
        ) 
开发者ID:LumenResearch,项目名称:heatmappy,代码行数:14,代码来源:heatmap.py

示例2: get_QBrush

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QBrush [as 别名]
def get_QBrush():
    """QBrush getter."""

    try:
        import PySide.QtGui as QtGui
        return QtGui.QBrush
    except ImportError:
        import PyQt5.QtGui as QtGui
        return QtGui.QBrush 
开发者ID:AirbusCyber,项目名称:grap,代码行数:11,代码来源:QtShim.py

示例3: initUI

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QBrush [as 别名]
def initUI(self):
        # container = QWidget(self)
        # container.resize(200, 100);
        # container.setStyleSheet("background-color:black;")

        font_size = QLabel('Font Size')
        font_size.fillColor = QColor(30, 30, 30, 120)
        font_size.penColor = QColor("#333333")

        grid = QGridLayout()
        grid.setContentsMargins(50, 10, 10, 10)
        grid.addWidget(font_size, 0, 0)
        self.setLayout(grid)

        # palette = QPalette(self.palette())
        # palette.setColor(self.backgroundRole(), Qt.black)
        # palette.setColor(palette.Background, Qt.transparent)

        # self.setPalette(palette)

    # def paintEvent(self, event):        
    #     painter = QPainter()
    #     painter.begin(self)
    #     # painter.setRenderHint(QPainter.Antialiasing)
    #     painter.fillRect(event.rect(), QBrush(QColor(255, 255, 255, 127)))
    #     painter.drawLine(self.width() / 8, self.height() / 8, 7 * self.width() / 8, 7 * self.height() / 8)
    #     painter.drawLine(self.width() / 8, 7 * self.height() / 8, 7 * self.width() / 8, self.height() / 8)
    #     # painter.setPen(QPen(Qt.NoPen)) 
开发者ID:jmwright,项目名称:cadquery-freecad-module,代码行数:30,代码来源:FinderOverlay.py

示例4: specifyNewGridColor

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QBrush [as 别名]
def specifyNewGridColor(self):
        color = QtGui.QColorDialog.getColor( self.colorRect.brush().color() )
        if color.isValid():
            self.colorRect.setBrush( QtGui.QBrush(color) )
            self.dd_parms.SetUnsigned( 'grid_color', RGBtoUnsigned(color.red(), color.green(), color.blue()) )
            dimensioningGrid.update() 
开发者ID:hamish2014,项目名称:FreeCAD_drawing_dimensioning,代码行数:8,代码来源:grid.py

示例5: clickFun

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QBrush [as 别名]
def clickFun(self):
        color = QtGui.QColorDialog.getColor( self.colorRect.brush().color() )
        if color.isValid():
            self.colorRect.setBrush( QtGui.QBrush(color) )
            self.dimensioningProcess.dimensionConstructorKWs[ self.name ] = 'rgb(%i,%i,%i)' % (color.red(), color.green(), color.blue() ) 
开发者ID:hamish2014,项目名称:FreeCAD_drawing_dimensioning,代码行数:7,代码来源:preferences.py

示例6: revertToDefault

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QBrush [as 别名]
def revertToDefault( self ):
        clr = QtGui.QColor(*unsignedToRGB(self.dd_parms.GetUnsigned( self.name, self.defaultValue )) )
        self.colorRect.setBrush( QtGui.QBrush( clr ) )
        self.dimensioningProcess.dimensionConstructorKWs[ self.name ] = self.getDefaultValue() 
开发者ID:hamish2014,项目名称:FreeCAD_drawing_dimensioning,代码行数:6,代码来源:preferences.py

示例7: generateWidget

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QBrush [as 别名]
def generateWidget( self, dimensioningProcess, width = 60, height = 30 ):
        self.dimensioningProcess = dimensioningProcess
        clr = QtGui.QColor(*unsignedToRGB(self.dd_parms.GetUnsigned( self.name, self.defaultValue )) )
        self.colorRect.setBrush( QtGui.QBrush( clr ) )
        colorBox = QtGui.QGraphicsView( self.graphicsScene )
        colorBox.setMaximumWidth( width )
        colorBox.setMaximumHeight( height )
        colorBox.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff )
        colorBox.setVerticalScrollBarPolicy( QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff )
        return  DimensioningTaskDialog_generate_row_hbox( self.label, colorBox ) 
开发者ID:hamish2014,项目名称:FreeCAD_drawing_dimensioning,代码行数:12,代码来源:preferences.py

示例8: generateWidget

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QBrush [as 别名]
def generateWidget(self, dimensioningProcess):
        self.dimensioningProcess = dimensioningProcess
        groupbox = QtGui.QGroupBox("Grid Options")
        groupbox.setCheckable( True ) 
        groupbox.toggled.connect( self.groupBoxToggled )
        self.groupbox = groupbox
        checked = self.dd_parms.GetBool("show_grid_options",True)
        groupbox.setChecked(checked)
        vbox = QtGui.QVBoxLayout()

        gridOn_checkbox = QtGui.QCheckBox('grid on')
        gridOn_checkbox.setChecked( self.dd_parms.GetBool( 'grid_on', False ))
        gridOn_checkbox.stateChanged.connect( self.gridOn_checkbox_stateChanged )
        vbox.addWidget( gridOn_checkbox )
        self.gridOn_checkbox =  gridOn_checkbox

        spacingSpinbox = QtGui.QDoubleSpinBox()
        spacingSpinbox.setValue( self.dd_parms.GetFloat( 'grid_spacing', default_grid_spacing )  )
        spacingSpinbox.setMinimum( 0.01 )
        spacingSpinbox.setDecimals( 2 )
        spacingSpinbox.setSingleStep( 0.5 )
        spacingSpinbox.setSuffix('mm')
        spacingSpinbox.valueChanged.connect( self.spacingSpinbox_valueChanged )
        vbox.addLayout( DimensioningTaskDialog_generate_row_hbox('spacing', spacingSpinbox) )
        self.spacingSpinbox = spacingSpinbox

        displayPeriodSpinbox = QtGui.QSpinBox()
        displayPeriodSpinbox.setValue( min( self.dd_parms.GetInt( 'grid_display_period', default_grid_display_period  ), 200)  )
        displayPeriodSpinbox.setMinimum( 0 )
        displayPeriodSpinbox.valueChanged.connect( self.displayPeriodSpinbox_valueChanged )
        vbox.addLayout( DimensioningTaskDialog_generate_row_hbox('display period', displayPeriodSpinbox) )
        self.displayPeriodSpinbox = displayPeriodSpinbox

        clr = QtGui.QColor(*unsignedToRGB(self.dd_parms.GetUnsigned( 'grid_color', default_grid_clr )) )
        graphicsScene = QtGui.QGraphicsScene(0,0,30,30)
        pen = QtGui.QPen( QtGui.QColor(0,0,0,0) )
        pen.setWidth(0.0)
        rect = ClickRect(-100, -100, 200, 200)
        rect.setPen(pen)
        rect.clickFun = self.specifyNewGridColor
        graphicsScene.addItem(rect) 
        self.graphicsScene = graphicsScene #protect from garbage collector
        self.colorRect = rect
        self.colorRect.setBrush( QtGui.QBrush( clr ) )
        colorBox = QtGui.QGraphicsView( self.graphicsScene )
        colorBox.setMaximumWidth( 60 )
        colorBox.setMaximumHeight( 30 )
        colorBox.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff )
        colorBox.setVerticalScrollBarPolicy( QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff )
        vbox.addLayout(  DimensioningTaskDialog_generate_row_hbox( 'color', colorBox ) )

        lineWidthSpinbox = QtGui.QDoubleSpinBox()
        lineWidthSpinbox.setValue( self.dd_parms.GetFloat( 'grid_line_width', default_grid_line_width )  )
        lineWidthSpinbox.setMinimum( 0. )
        lineWidthSpinbox.setDecimals( 2 )
        lineWidthSpinbox.setSingleStep( 0.05 )
        lineWidthSpinbox.valueChanged.connect( self.lineWidthSpinbox_valueChanged )
        vbox.addLayout( DimensioningTaskDialog_generate_row_hbox('lineWidth', lineWidthSpinbox) )
        self.lineWidthSpinbox = lineWidthSpinbox
        groupbox.setLayout(vbox)
        return groupbox 
开发者ID:hamish2014,项目名称:FreeCAD_drawing_dimensioning,代码行数:63,代码来源:grid.py

示例9: addModel

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QBrush [as 别名]
def addModel(self, model, treeRoot=None):
        ''' Adds the given model to the variable browser
        '''
        self.itemChanged.disconnect()
        model.setVariableTree()

        if treeRoot is None:
            treeRoot = QtGui.QTreeWidgetItem(self)
            treeRoot.setCheckState(0, QtCore.Qt.Checked)
            treeRoot.setFlags(treeRoot.flags() & ~QtCore.Qt.ItemIsEditable & ~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsUserCheckable)
            treeRoot.setText(0, model.numberedModelName)
            if model.modelType == 'None':
                treeRoot.setForeground(0, QtGui.QBrush(QtGui.QColor('grey')))
            treeRoot.numberedModelName = model.numberedModelName
            treeRoot.model = model
            treeRoot.isModelRoot = True
            treeRoot.setFirstColumnSpanned(True)
            treeRoot.setExpanded(True)
            model.rootItem = treeRoot
        elif treeRoot.childCount() > 0:
            # Define function that is called when a item of the tree will be checked/unchecked
            self.itemChanged.connect(self.browserItemCheckChanged)
            return

        # Define the tipText displayed when stopping the mouse over the numbered model name in the variable browser
        tipText = 'Model type: ' + model.modelType
        if model.variableTree.rootAttribute is not None:
            if len(model.variableTree.rootAttribute) > 0:
                tipText += '\n\n' + model.variableTree.rootAttribute
        treeRoot.setToolTip(0, tipText)
        # Generate a nice list of model variables
        # variableNames = model.variableTree.variable.keys()
        variableNames = list()
        for name, variable in model.variableTree.variable.iteritems():
            variableNames.append([variable.browserName, name])

        def natsort_key(x1, _nsre=re.compile('([0-9]+)')):
            x = x1[0]
            return [int(text) if text.isdigit() else text.lower() for text in re.split(_nsre, x)]

        # Sort the variables for the tree
        variableNames.sort(key=natsort_key)

        for v in variableNames:
            self.addItemToTree(treeRoot, v[0], v[1], model)

        # Show changed start values in startValueBox given in model.settings
        for variable in model.changedStartValue:
            self.setVariable(model, variable, model.changedStartValue[variable])

        # Define function that is called when a item of the tree will be checked/unchecked
        self.itemChanged.connect(self.browserItemCheckChanged)
        self.itemExpanded.connect(self.dyamicLoadBranch)
        # To set this model as current one
        self.browserItemCheckChanged(treeRoot) 
开发者ID:PySimulator,项目名称:PySimulator,代码行数:57,代码来源:VariablesBrowser.py


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