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


Python QColor.setAlphaF方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlphaF [as 别名]
 def __init__(self, size, dynamic, controller):
     layer.__init__(self,size,dynamic)
     self.controller = controller
     self.ready = False
     
     dotColor = QColor()
     dotColor.setNamedColor(self.controller.svgLayer.svg.dotPrototype.getAttribute('fill'))
     dotColor.setAlphaF(float(self.controller.svgLayer.svg.dotPrototype.getAttribute('fill-opacity')))
     self.dotColors = []
     i = 0
     while i <= 1.0:
         self.dotColors.append(QColor.fromRgbF(dotColor.redF(),dotColor.greenF(),dotColor.blueF(),i))
         i += dotColor.alphaF()
     
     self.dotWidth = self.controller.svgLayer.svg.dotPrototype.width()
     self.dotHeight = self.controller.svgLayer.svg.dotPrototype.height()
     
     self.halfDotWidth = self.dotWidth/2
     self.halfDotHeight = self.dotHeight/2
     
     self.xoffset = self.controller.scatterBounds[0]-self.halfDotWidth
     self.yoffset = self.controller.scatterBounds[3]-self.halfDotHeight
     
     self.xNonNumeric = (self.controller.svgLayer.svg.xNonNumericIcon.left() + self.controller.svgLayer.svg.xNonNumericIcon.right())/2 - self.halfDotWidth
     self.yNonNumeric = (self.controller.svgLayer.svg.yNonNumericIcon.top() + self.controller.svgLayer.svg.yNonNumericIcon.bottom())/2 - self.halfDotHeight
开发者ID:alex-r-bigelow,项目名称:compreheNGSive,代码行数:27,代码来源:scatterplotWidget.py

示例2: _fade

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlphaF [as 别名]
    def _fade(self, lineno):
        cursor = self._get_line_cursor(lineno)

        fmt = cursor.charFormat()
        color=QColor('black')
        color.setAlphaF(0.5)
        fmt.setForeground(color)
        cursor.beginEditBlock()
        cursor.mergeCharFormat(fmt)
        cursor.endEditBlock()
开发者ID:UManPychron,项目名称:pychron,代码行数:12,代码来源:patch_editor.py

示例3: __init__

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlphaF [as 别名]
 def __init__(self, size, dynamic, controller, prototypeLine, opaqueBack = False):
     layer.__init__(self,size,dynamic)
     self.controller = controller
     self.points = set()
     if opaqueBack:
         self.backgroundColor = Qt.white
     else:
         self.backgroundColor = Qt.transparent
     
     lineColor = QColor()
     lineColor.setNamedColor(prototypeLine.getAttribute('stroke'))
     lineColor.setAlphaF(float(prototypeLine.getAttribute('stroke-opacity')))
     self.pen = QPen(lineColor)
     
     self.pen.setWidthF(prototypeLine.getAttribute('stroke-width'))
开发者ID:alex-r-bigelow,项目名称:compreheNGSive,代码行数:17,代码来源:parallelCoordinateWidget.py

示例4: selectionLayer

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlphaF [as 别名]
class selectionLayer(layer):
    def __init__(self, size, dynamic, controller, prototypeDot):
        layer.__init__(self,size,dynamic)
        self.controller = controller
        self.points = set()
        
        self.dotColor = QColor()
        self.dotColor.setNamedColor(prototypeDot.getAttribute('fill'))
        self.dotColor.setAlphaF(float(prototypeDot.getAttribute('fill-opacity')))
        self.dotWidth = prototypeDot.width()
        self.xoffset = self.controller.svgLayer.svg.xZeroBar.left()-self.dotWidth/2+1
        #self.xoffset = self.controller.scatterBounds[0]-self.dotWidth/2+1
        self.dotHeight = prototypeDot.height()
        self.yoffset = self.controller.svgLayer.svg.yZeroBar.bottom()-self.dotWidth/2+1
        #self.yoffset = self.controller.scatterBounds[3]-self.dotHeight/2+1
        self.xNonNumeric = (self.controller.svgLayer.svg.xNonNumericIcon.left() + self.controller.svgLayer.svg.xNonNumericIcon.right())/2 - self.dotWidth/2
        self.yNonNumeric = (self.controller.svgLayer.svg.yNonNumericIcon.top() + self.controller.svgLayer.svg.yNonNumericIcon.bottom())/2 - self.dotHeight/2
    
    def handleFrame(self, event, signals):
        return signals
    
    def updateAxes(self):
        self.xoffset = self.controller.svgLayer.svg.xZeroBar.left()-self.dotWidth/2+1
        self.yoffset = self.controller.svgLayer.svg.yZeroBar.bottom()-self.dotWidth/2+1
    
    def update(self, points):
        self.points = points
    
    def draw(self,painter):
        self.reverseXratio = 1.0/self.controller.xAxisRatio
        self.reverseYratio = 1.0/self.controller.yAxisRatio
        
        self.image.fill(Qt.transparent)
        for x,y in self.controller.vData.get2dData(self.points,self.controller.app.currentXattribute,self.controller.app.currentYattribute):
            valuePairs = []
            if isinstance(x,list):
                if isinstance(y,list):
                    assert len(x) == len(y)
                    valuePairs = zip(x,y)
                else:
                    valuePairs = [(x0,y) for x0 in x]
            elif isinstance(y,list):
                valuePairs = [(x,y0) for y0 in y]
            else:
                valuePairs = [(x,y)]
            
            for x0,y0 in valuePairs:
                if x0 == None or (not isinstance(x0,int) and not isinstance(x0,float)) or math.isinf(x0) or math.isnan(x0):
                    x0 = self.xNonNumeric
                else:
                    x0 = self.xoffset + x0*self.reverseXratio
                
                if y0 == None or (not isinstance(y0,int) and not isinstance(y0,float)) or math.isinf(y0) or math.isnan(y0):
                    y0 = self.yNonNumeric
                else:
                    y0 = self.yoffset + y0*self.reverseYratio
                painter.fillRect(x0,y0,self.dotWidth,self.dotHeight,self.dotColor)
    
    def getPoints(self, x, y):
        lowX=self.controller.screenToDataSpace(x-self.controller.cursorXradius, self.controller.scatterBounds[0], self.controller.currentXaxis.minimum, self.controller.xAxisRatio)
        lowY=self.controller.screenToDataSpace(y+self.controller.cursorYradius, self.controller.scatterBounds[3], self.controller.currentYaxis.minimum, self.controller.yAxisRatio)
        highX=self.controller.screenToDataSpace(x+self.controller.cursorXradius, self.controller.scatterBounds[0], self.controller.currentXaxis.minimum, self.controller.xAxisRatio)
        highY=self.controller.screenToDataSpace(y-self.controller.cursorYradius, self.controller.scatterBounds[3], self.controller.currentYaxis.minimum, self.controller.yAxisRatio)
        
        if (x + self.controller.cursorXradius >= self.xNonNumeric) and (x - self.controller.cursorXradius <= self.xNonNumeric + self.dotWidth):
            xSet = self.controller.vData.axisLookups[self.controller.app.currentXattribute].categoricalKeys
        else:
            xSet = set()
        if (y + self.controller.cursorYradius >= self.yNonNumeric) and (y - self.controller.cursorYradius <= self.yNonNumeric + self.dotHeight):
            ySet = self.controller.vData.axisLookups[self.controller.app.currentXattribute].categoricalKeys
        else:
            ySet = set()
        
        return self.controller.vData.query2D(self.controller.app.currentXattribute,[(lowX,highX)],xSet,
                                             self.controller.app.currentYattribute,[(lowY,highY)],ySet)
开发者ID:alex-r-bigelow,项目名称:compreheNGSive,代码行数:77,代码来源:scatterplotWidget.py


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