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


Python QtGui.QBrush方法代码示例

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


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

示例1: draw_editor

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def draw_editor(painter, rect, snap=None):
    # draw border
    pen = QtGui.QPen(QtGui.QColor('#333333'))
    pen.setStyle(QtCore.Qt.DashDotLine)
    pen.setWidth(3)
    brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 25))
    painter.setPen(pen)
    painter.setBrush(brush)
    painter.drawRect(rect)

    if snap is None:
        return
    # draw snap grid
    pen = QtGui.QPen(QtGui.QColor('red'))
    painter.setPen(pen)
    x = 0
    y = 0
    while y < rect.bottom():
        painter.drawPoint(x, y)
        x += snap[0]
        if x > rect.right():
            x = 0
            y += snap[1] 
开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:25,代码来源:painting.py

示例2: draw_manipulator

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def draw_manipulator(painter, manipulator, cursor):
    hovered = manipulator.hovered_rects(cursor)

    if manipulator.rect in hovered:
        pen = QtGui.QPen(QtGui.QColor(0, 0, 0, 0))
        brush = QtGui.QBrush(QtGui.QColor(125, 125, 125))
        brush.setStyle(QtCore.Qt.FDiagPattern)
        painter.setPen(pen)
        painter.setBrush(brush)
        painter.drawPath(manipulator.hovered_path)

    pen = QtGui.QPen(QtGui.QColor('black'))
    brush = QtGui.QBrush(QtGui.QColor('white'))
    painter.setBrush(brush)
    for rect in manipulator.handler_rects():
        pen.setWidth(3 if rect in hovered else 1)
        painter.setPen(pen)
        painter.drawEllipse(rect)

    pen.setWidth(1)
    pen.setStyle(QtCore.Qt.DashLine)  # if not moving else QtCore.Qt.SolidLine)
    painter.setPen(pen)
    painter.setBrush(QtGui.QBrush(QtGui.QColor(0, 0, 0, 0)))
    painter.drawRect(manipulator.rect) 
开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:26,代码来源:painting.py

示例3: __init__

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def __init__(self, name=None):

        pen = QtGui.QPen(QtCore.Qt.SolidLine)
        pen.setColor(QtGui.QColor(0, 0, 0, 255))
        pen.setWidthF(0.2)
        pen.setJoinStyle(QtCore.Qt.MiterJoin)
        self.pen = pen

        self.brush = QtGui.QBrush(QtGui.QColor(255, 255, 0, 255))
        self.font = QtGui.QFont('Decorative', 12)

        self.rect = QtCore.QRectF()
        self.shape = QtGui.QPainterPath()
        self.path = QtGui.QPainterPath()

        self.scale = (1, 1)
        self.tooltip = ''

        self.method = ''
        self.args = [] 
开发者ID:chiefenne,项目名称:PyAero,代码行数:22,代码来源:GraphicsItemsCollection.py

示例4: __init__

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def __init__(self, *args, **kwargs):

        super().__init__(*args, **kwargs)

        self.view = args[1]

        # set pen and brush (filling)
        self.pen = QtGui.QPen()
        self.pen.setStyle(QtCore.Qt.DotLine)
        self.pen.setColor(QtGui.QColor(80, 80, 100))
        self.brush = QtGui.QBrush()
        color = QtGui.QColor(20, 20, 80, 30)
        self.brush.setColor(color)
        # self.brush.setStyle(QtCore.Qt.NoBrush)
        self.brush.setStyle(QtCore.Qt.SolidPattern)

        # set style selectively for the rubberband like that
        # see: http://stackoverflow.com/questions/25642618
        # required as opacity might not work
        # NOTE: opacity removed here
        self.setStyle(QtWidgets.QStyleFactory.create('windowsvista'))

        # set boolean for allowing zoom
        self.allow_zoom = False 
开发者ID:chiefenne,项目名称:PyAero,代码行数:26,代码来源:GraphicsView.py

示例5: _brush

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def _brush(self, b: Brush, p: QPainter):
        """Configure the given brush."""
        brush = None

        if b.index is not None:  # This is a cached brush.
            brush = self.brushes.get(b.index)
        elif b.style == BrushStyle.PATTERN:
            pm = QPixmap.loadFromData(b.data, _fmt[b.bpp])
            brush = QBrush(pm)
        elif b.style == BrushStyle.HATCHED:
            brush = QBrush(_hs[b.hatch])
        else:
            brush = QBrush(_bs[b.style])

        p.setBrush(brush)
        p.setBrushOrigin(b.x, b.y)

    # Drawing API. 
开发者ID:GoSecure,项目名称:pyrdp,代码行数:20,代码来源:draw.py

示例6: mem3Blt

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def mem3Blt(self, state: Mem3Blt):
        LOG.debug(state)
        if state.cacheId == BITMAPCACHE_SCREEN_ID:
            # Use offscreen bitmap as a source.
            src = self.surfaces[state.cacheIndex]
        else:
            src = self.bitmaps.get(state.cacheId, state.cacheIndex)

            if src is None:
                return  # Ignore cache misses.

        p = self._paint(self.surface)
        self._brush(state.brush, p)
        set_rop3(state.rop, p)
        p.brush().setColor(rgb_to_qcolor(state.fg))
        p.setBackground(QBrush(rgb_to_qcolor(state.bg)))

        p.drawImage(state.left, state.top, src, state.xSrc, state.ySrc, state.width, state.height)
        self._end(p) 
开发者ID:GoSecure,项目名称:pyrdp,代码行数:21,代码来源:draw.py

示例7: polygonCb

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def polygonCb(self, state: PolygonCb):
        LOG.debug(state)
        p = self._paint(self.surface)
        self._brush(state.brush)
        p.brush().setColor(rgb_to_qcolor(state.fg))
        p.setBackground(QBrush(rgb_to_qcolor(state.bg)))
        set_rop2(state.rop2, p)

        # Handle background mode.
        if state.brush.style in [BrushStyle.PATTERN, BrushStyle.HATCHED]:
            p.setBackgroundMode(Qt.TransparentMode if state.bgMode == BACKMODE_TRANSPARENT else Qt.OpaqueMode)

        polygon = QPolygon()
        polygon.append(QPoint(state.x0, state.y0))
        for (x, y) in state.points:
            polygon.append(QPoint(x, y))

        p.drawPolygon(polygon, _fill[state.fillMode])
        self._end(p) 
开发者ID:GoSecure,项目名称:pyrdp,代码行数:21,代码来源:draw.py

示例8: draw

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def draw(self, glyph: GlyphEntry, p: QPainter):
        """Render a glyph using the given painter."""
        # Adjust the glyph coordinates to center it on origin
        x = self.x + glyph.x
        y = self.y + glyph.y

        if not self.fOpRedundant:
            p.fillRect(x, y, glyph.w, glyph.h, rgb_to_qcolor(self.fg))

        p.setBrush(QBrush(rgb_to_qcolor(self.bg), glyph.bitmap))
        p.setBrushOrigin(x, y)
        p.drawRect(x, y, glyph.w, glyph.h)

        if self.flAccel & SO_CHAR_INC_EQUAL_BM_BASE:
            self.x += glyph.w


# Map brush styles to Qt brush style 
开发者ID:GoSecure,项目名称:pyrdp,代码行数:20,代码来源:draw.py

示例9: paint

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def paint(self, painter, option, widget):
        lod = option.levelOfDetailFromTransform(painter.worldTransform())
        should_highlight = self._should_highlight()

        if should_highlight:
            pen = QPen(QColor(0, 0xfe, 0xfe), 2, self.style)
        else:
            pen = QPen(self.color, 2, self.style)
        painter.setPen(pen)

        painter.drawPath(self.path)

        # arrow
        if lod < 0.3:
            return

        # arrow
        if should_highlight:
            brush = QBrush(QColor(0, 0xfe, 0xfe))
        else:
            brush = QBrush(self.color)
        painter.setBrush(brush)
        painter.drawPolygon(self.arrow) 
开发者ID:angr,项目名称:angr-management,代码行数:25,代码来源:qgraph_arrow.py

示例10: _loopDraw

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def _loopDraw(self, c):
		font = self.__getFont()
		flags = QtCore.Qt.AlignCenter
		startX = self.__getTextStartX()
		startY = self.__getTextStartY()
		width = self._getOriginalWidth()
		height = self._getOriginalHeight()

		pen = QtGui.QPen()
		pen.setBrush(QtGui.QBrush(getColor(self.textColor)))

		if self.backgroundColor:
			brush = QtGui.QBrush()
			brush.setColor(getColor(self.backgroundColor))
			brush.setStyle(QtCore.Qt.SolidPattern)
			c.setBrush(brush)

			c.setPen(getColor("transparent"))

			c.drawRect(startX, startY, width, height)

		c.setFont(font)
		c.setPen(pen)
		c.drawText(startX, startY, width, height, flags, str(self.text)) 
开发者ID:yuehaowang,项目名称:pylash_engine,代码行数:26,代码来源:display.py

示例11: draw_editor_center

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def draw_editor_center(painter, rect, point):
    color = QtGui.QColor(200, 200, 200, 125)
    painter.setPen(QtGui.QPen(color))
    painter.setBrush(QtGui.QBrush(color))
    painter.drawRect(rect)

    path = get_center_path(QtCore.QPoint(*point))
    pen = QtGui.QPen(QtGui.QColor(50, 125, 255))
    pen.setWidth(2)
    painter.setPen(pen)
    painter.drawPath(path) 
开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:13,代码来源:painting.py

示例12: draw_selection_square

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def draw_selection_square(painter, rect):
    bordercolor = QtGui.QColor(SELECTION_COLOR)
    backgroundcolor = QtGui.QColor(SELECTION_COLOR)
    backgroundcolor.setAlpha(85)
    painter.setPen(QtGui.QPen(bordercolor))
    painter.setBrush(QtGui.QBrush(backgroundcolor))
    painter.drawRect(rect) 
开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:9,代码来源:painting.py

示例13: drawFocusRect

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def drawFocusRect(self, painter):
        self.focusbrush = QtGui.QBrush()
        self.focuspen = QtGui.QPen(QtCore.Qt.DashLine)
        self.focuspen.setColor(QtCore.Qt.darkGray)
        self.focuspen.setWidthF(1.0)
        # no pen thickness change when zoomed
        self.focuspen.setCosmetic(True)  # no thickness change when zoomed
        painter.setBrush(self.focusbrush)
        painter.setPen(self.focuspen)

        painter.drawRect(self.boundingRect()) 
开发者ID:chiefenne,项目名称:PyAero,代码行数:13,代码来源:GraphicsItem.py

示例14: get

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def get(self, idx: int) -> QBrush:
        if idx in self.entries:
            return self.entries[idx]
        else:
            return None 
开发者ID:GoSecure,项目名称:pyrdp,代码行数:7,代码来源:cache.py

示例15: add

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QBrush [as 别名]
def add(self, idx: int, b: QBrush):
        self.entries[idx] = b 
开发者ID:GoSecure,项目名称:pyrdp,代码行数:4,代码来源:cache.py


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