本文整理汇总了Python中PyQt5.Qt.QPainterPath.addRoundedRect方法的典型用法代码示例。如果您正苦于以下问题:Python QPainterPath.addRoundedRect方法的具体用法?Python QPainterPath.addRoundedRect怎么用?Python QPainterPath.addRoundedRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QPainterPath
的用法示例。
在下文中一共展示了QPainterPath.addRoundedRect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: paint_background
# 需要导入模块: from PyQt5.Qt import QPainterPath [as 别名]
# 或者: from PyQt5.Qt.QPainterPath import addRoundedRect [as 别名]
def paint_background(self, painter):
br = 12 # border_radius
bw = 1 # border_width
c = QColor('#fdfd96')
p = QPainterPath()
p.addRoundedRect(QRectF(self.rect()), br, br)
painter.fillPath(p, c)
p.addRoundedRect(QRectF(self.rect()).adjusted(bw, bw, -bw, -bw), br, br)
painter.fillPath(p, QColor('black'))
示例2: paint_background
# 需要导入模块: from PyQt5.Qt import QPainterPath [as 别名]
# 或者: from PyQt5.Qt.QPainterPath import addRoundedRect [as 别名]
def paint_background(self, painter):
br = 12 # border_radius
bw = 1 # border_width
pal = self.palette()
c = pal.color(pal.Window)
c.setAlphaF(0.9)
p = QPainterPath()
p.addRoundedRect(QRectF(self.rect()), br, br)
painter.fillPath(p, c)
p.addRoundedRect(QRectF(self.rect()).adjusted(bw, bw, -bw, -bw), br, br)
painter.fillPath(p, pal.color(pal.WindowText))
示例3: __call__
# 需要导入模块: from PyQt5.Qt import QPainterPath [as 别名]
# 或者: from PyQt5.Qt.QPainterPath import addRoundedRect [as 别名]
def __call__(self, painter, rect, color_theme, title_block, subtitle_block, footer_block):
painter.fillRect(rect, self.color1)
r = QRect(0, int(title_block.position.y), rect.width(),
title_block.height + subtitle_block.height + subtitle_block.line_spacing // 2 + title_block.leading)
painter.save()
p = QPainterPath()
p.addRoundedRect(QRectF(r), 10, 10 * r.width()/r.height(), Qt.RelativeSize)
painter.setClipPath(p)
painter.setRenderHint(QPainter.Antialiasing)
painter.fillRect(r, self.color2)
painter.restore()
r = QRect(0, 0, int(title_block.position.x), rect.height())
painter.fillRect(r, self.color2)
return self.ccolor2, self.ccolor2, self.ccolor1