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


Python QColor.setAlpha方法代码示例

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


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

示例1: fromStr

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlpha [as 别名]
 def fromStr(name, a=255):
     if name in _Colorizer.__colorTable:
         c = QColor(_Colorizer.__colorTable[name])
     else:
         c = QColor(Qt.transparent)
     c.setAlpha(a)
     return c
开发者ID:RayRiver,项目名称:behavior-studio,代码行数:9,代码来源:alphabet.py

示例2: _init_ui

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlpha [as 别名]
    def _init_ui(self, txt):
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint)

        pal = QPalette()
        color = QColor()
        color.setNamedColor(self._window_bgcolor)
        color.setAlpha(255 * self._opacity)
        pal.setColor(QPalette.Background, color)

        self.setAutoFillBackground(True)
        self.setPalette(pal)

        wm, hm = 5, 5
        spacing = 8
        layout = QVBoxLayout()
        layout.setSpacing(spacing)
        layout.setContentsMargins(wm, hm, wm, hm)

        nlines, ts = self._generate_text(txt)

        qlabel = QLabel('\n'.join(ts))

        ss = 'QLabel {{color: {}; font-family:{}, sans-serif; font-size: {}px}}'.format(self._color,
                                                                                        self._font,
                                                                                        self._fontsize)
        qlabel.setStyleSheet(ss)
        layout.addWidget(qlabel)

        hlabel = QLabel('double click to dismiss')
        hlabel.setStyleSheet('QLabel {font-size: 10px}')

        hlayout = QHBoxLayout()

        hlayout.addStretch()
        hlayout.addWidget(hlabel)
        hlayout.addStretch()

        layout.addLayout(hlayout)

        self.setLayout(layout)

        font = QFont(self._font, self._fontsize)
        fm = QFontMetrics(font)

        pw = max([fm.width(ti) for ti in ts])
        ph = (fm.height() + 2) * nlines

        w = pw + wm * 2
        h = ph + (hm + spacing + 1) * 2

        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.setFixedWidth(w)
        self.setFixedHeight(h)

        self.setMask(mask(self.rect(), 10))
开发者ID:OSUPychron,项目名称:pychron,代码行数:57,代码来源:notification_widget.py

示例3: routeFinished

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlpha [as 别名]
    def routeFinished(self):

        if not self.routeReply.routes():
            return

        route = QGeoMapRouteObject(self.routeReply.routes()[0])
        routeColor = QColor(Qt.blue)
        routeColor.setAlpha(127)
        pen = QPen(routeColor)
        pen.setWidth(7)
        pen.setCosmetic(True)
        pen.setCapStyle(Qt.RoundCap)
        route.setPen(pen)
        self.mapWidget.addMapObject(route)
开发者ID:AmerGit,项目名称:Examples,代码行数:16,代码来源:mapviewer.py

示例4: drawPolygon

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlpha [as 别名]
    def drawPolygon(self):
        path = [mark.coordinate() for mark in self.markerObjects]

        pen = QPen(Qt.white)
        pen.setWidth(2)
        pen.setCosmetic(True)
        polygon = QGeoMapPolygonObject()
        polygon.setPen(pen)
        fill = QColor(Qt.black)
        fill.setAlpha(65)
        polygon.setBrush(QBrush(fill))
        polygon.setPath(path)

        self.mapWidget.addMapObject(polygon)
开发者ID:AmerGit,项目名称:Examples,代码行数:16,代码来源:mapviewer.py

示例5: drawRect

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlpha [as 别名]
    def drawRect(self):
        if len(self.markerObjects) < 2:
            return

        p1, p2 = self.markerObjects[:2]

        pen = QPen(Qt.white)
        pen.setWidth(2)
        pen.setCosmetic(True)
        fill = QColor(Qt.black)
        fill.setAlpha(65)
        rectangle = QGeoMapRectangleObject(p1.coordinate(), p2.coordinate())
        rectangle.setPen(pen)
        rectangle.setBrush(QBrush(fill))
        self.mapWidget.addMapObject(rectangle)
开发者ID:AmerGit,项目名称:Examples,代码行数:17,代码来源:mapviewer.py

示例6: WeekCalendar

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlpha [as 别名]
class WeekCalendar(QCalendarWidget):

    def __init__(self, *args):

        QCalendarWidget.__init__(self, *args)
        self.color = QColor(self.palette().color(QPalette.Highlight))
        self.color.setAlpha(64)
        self.selectionChanged.connect(self.updateCells)

    def paintCell(self, painter, rect, date):

        QCalendarWidget.paintCell(self, painter, rect, date)
        filelist = glob.glob('journal_[0-9]*')
        datelist = []
        for i in filelist:
            l = tuple(i[i.index('_') + 1:].split('_'))
            datelist.append(QDate(int(l[2]), int(l[1]), int(l[0])))
        if date in datelist:
            painter.fillRect(rect, self.color)
开发者ID:balasankarc,项目名称:rahasya,代码行数:21,代码来源:color.py

示例7: createPixmapIcon

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlpha [as 别名]
    def createPixmapIcon(self):
        self.markerIcon = QPixmap(MARKER_WIDTH, MARKER_HEIGHT)
        self.markerIcon.fill(Qt.transparent)

        painter = QPainter(self.markerIcon)

        p1 = QPoint(MARKER_WIDTH / 2, MARKER_HEIGHT - 1)
        p2 = QPoint(MARKER_WIDTH / 2, MARKER_HEIGHT - 1 - MARKER_PIN_LEN)
        pen = QPen(Qt.black)
        pen.setWidth(2)
        pen.setCosmetic(True)
        painter.setPen(pen)
        painter.drawLine(p1, p2)
        ellipse = QRect(0, 0, MARKER_WIDTH - 1, MARKER_HEIGHT - 1)
        pen.setWidth(1)
        painter.setPen(pen)
        color = QColor(Qt.green)
        color.setAlpha(127)
        brush = QBrush(color)
        painter.setBrush(brush)
        painter.drawEllipse(ellipse)
开发者ID:AmerGit,项目名称:Examples,代码行数:23,代码来源:mapviewer.py

示例8: drawCircle

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlpha [as 别名]
    def drawCircle(self):

        if not len(self.markerObjects):
            return

        p1 = self.markerObjects[0]
        center = p1.coordinate()

        radius = 3000 # Meters

        if len(self.markerObjects) >= 2:
            radius = center.distanceTo(self.markerObjects[1].coordinate())

        pen = QPen(Qt.white)
        pen.setWidth(2)
        pen.setCosmetic(True)
        circle = QGeoMapCircleObject(center, radius)
        circle.setPen(pen)
        fill = QColor(Qt.black)
        fill.setAlpha(65)
        circle.setBrush(QBrush(fill))

        self.mapWidget.addMapObject(circle)
开发者ID:AmerGit,项目名称:Examples,代码行数:25,代码来源:mapviewer.py

示例9: fromQcolor

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlpha [as 别名]
 def fromQcolor(qtColor, a=255):
     c = QColor(qtColor)
     c.setAlpha(a)
     return c
开发者ID:RayRiver,项目名称:behavior-studio,代码行数:6,代码来源:alphabet.py

示例10: QcolorA

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlpha [as 别名]
def QcolorA(color, alpha):
    col = QColor(color)
    col.setAlpha(alpha)
    return col
开发者ID:RayRiver,项目名称:behavior-studio,代码行数:6,代码来源:colors.py

示例11: _display_color

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlpha [as 别名]
def _display_color(color, selected):
    alpha = 0.7 if selected else 0.4
    color = QColor(color)
    color.setAlpha(255 * alpha)  # Set alpha to half for display
    return color
开发者ID:jthacker,项目名称:arrview,代码行数:7,代码来源:roi.py

示例12: QColor

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlpha [as 别名]
from PySide.QtGui import QColor, QBrush, QPen
from PySide.QtCore import Qt

print "Initializing Color"

colorHexLine        = QColor(Qt.green)
colorHexBrush       = QColor(192,255,192)
colorHexRoute       = QColor(255,192,0)
colorHexRoute.setAlpha(128)
colorHexRouteSel    = QColor(192,128,0)
colorHexRouteSel.setAlpha(128)


penLine             = QPen(colorHexLine)
penLine.setWidthF(2.0)
penRoute            = QPen(colorHexRoute)
penRoute.setWidthF(12.0)
penRouteSel         = QPen(colorHexRouteSel)
penRouteSel.setWidthF(12.0)

brushHex            = QBrush(colorHexBrush) 
开发者ID:maxlambertini,项目名称:SWNSectorCreator,代码行数:23,代码来源:SWNConstants.py

示例13: draw

# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import setAlpha [as 别名]
 def draw(self, painter, offset=Point()):
     painter.setPen(self.pen)
     color = QColor(self.pen.color())
     color.setAlpha(50)
     painter.setBrush(QColor(color))
     painter.drawRect(self.origin.x + offset.x, self.origin.y + offset.y, self.size.width, self.size.height)
开发者ID:Ingener74,项目名称:Small-Screwdriver,代码行数:8,代码来源:Rect.py


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