Python PyQt5.QtCore.Qt 模块,SolidPattern() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用PyQt5.QtCore.Qt.SolidPattern()

项目:thegame    作者:afg984    | 项目源码 | 文件源码
def paint(
            self,
            painter: QPainter,
            option: QStyleOptionGraphicsItem,
            widget: QWidget):
        pen = QPen()
        pen.setWidth(3)
        painter.setRenderHint(QPainter.Antialiasing)
        pen.setColor(QColor(61, 61, 61, 255))
        painter.setPen(pen)
        painter.setBrush(QBrush(QColor(61, 61, 61, 255), Qt.SolidPattern))
        painter.drawRect(
            QRectF(-self.maxWidth / 2, -10, self.maxWidth, 20))
        painter.setBrush(QBrush(QColor(240, 217, 108, 255), Qt.SolidPattern))
        painter.drawRect(
            QRectF(-self.maxWidth / 2, -10, self.displayWidth, 20))
        path = QPainterPath()

        path.addText(-self.maxWidth / 2, 35, QFont('monospace', 18, QFont.Bold), f'{self.name}  Lv.{self.level}  Exp. {self.actualExperience:{len(str(self.maxExperience))}}/{self.maxExperience}')

        # pen.setColor(Qt.white)
        pen.setWidth(2)
        painter.setPen(pen)
        painter.setBrush(QBrush(QColor(0, 0, 0, 61), Qt.SolidPattern))
        painter.drawPath(path)
项目:thegame    作者:afg984    | 项目源码 | 文件源码
def paint(
            self,
            painter: QPainter,
            option: QStyleOptionGraphicsItem,
            widget: QWidget):
        pen = QPen()
        pen.setWidth(1)
        painter.setRenderHint(QPainter.Antialiasing)
        pen.setColor(QColor(81, 81, 81, 255))
        painter.setPen(pen)
        painter.setBrush(QBrush(QColor(81, 81, 81, 255), Qt.SolidPattern))
        path = QPainterPath()
        path.addText(
            -self.width,
            self.height,
            QFont('monospace', 13, QFont.PreferNoHinting),
            self.text)
        painter.drawPath(path)
项目:thegame    作者:afg984    | 项目源码 | 文件源码
def paint(
            self,
            painter: QPainter,
            option: QStyleOptionGraphicsItem,
            widget: QWidget):
        pen = QPen()
        pen.setWidth(1)
        painter.setRenderHint(QPainter.Antialiasing)
        pen.setColor(QColor(81, 81, 81, 255))
        painter.setPen(pen)
        painter.setBrush(QBrush(QColor(81, 81, 81, 255), Qt.SolidPattern))
        for i, score in enumerate(self.scores):
            path = QPainterPath()
            path.addText(
                -self.width,
                14 + i * 16,
                QFont('monospace', 13, QFont.PreferNoHinting),
                f'{score.score:6}[{score.level:2}]  {score.hero_name}')
            painter.drawPath(path)
项目:satellite-tracker    作者:lofaldli    | 项目源码 | 文件源码
def brush(self, color=Qt.white, style=Qt.SolidPattern):
        return QBrush(color, style)
项目:thegame    作者:afg984    | 项目源码 | 文件源码
def paint(
        self,
        painter: QPainter,
        option: QStyleOptionGraphicsItem,
        widget: QWidget,
    ):
        painter.setRenderHint(QPainter.Antialiasing)
        painter.setPen(const.FramePen)
        painter.setBrush(const.HeroBarrelBrush)
        painter.drawPolygon(self.barrel)
        painter.setBrush(const.HeroBrush)
        painter.setBrush(QBrush(QColor(0, 178, 255, 255), Qt.SolidPattern))
        painter.drawEllipse(
            -self.width / 2, -self.width / 2, self.width, self.width)