本文整理匯總了Python中PyQt5.Qt.QPainterPath.addText方法的典型用法代碼示例。如果您正苦於以下問題:Python QPainterPath.addText方法的具體用法?Python QPainterPath.addText怎麽用?Python QPainterPath.addText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.Qt.QPainterPath
的用法示例。
在下文中一共展示了QPainterPath.addText方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: drawContents
# 需要導入模塊: from PyQt5.Qt import QPainterPath [as 別名]
# 或者: from PyQt5.Qt.QPainterPath import addText [as 別名]
def drawContents(self, painter):
self.drawn_once = True
painter.save()
painter.setPen(Qt.black)
painter.setRenderHint(painter.TextAntialiasing, True)
painter.setRenderHint(painter.Antialiasing, True)
f = painter.font()
f.setPixelSize(18)
painter.setFont(f)
t = QTransform()
t.translate(330, 450)
painter.setTransform(t)
painter.rotate(-98)
left_margin = 25
if iswindows:
# On windows Qt cannot anti-alias rotated text
p = QPainterPath()
p.addText(left_margin, 0, f, self.message())
painter.fillPath(p, QBrush(Qt.black))
else:
painter.drawText(left_margin, 0, self.message())
painter.restore()