本文整理汇总了Python中PyQt4.QtCore.QLineF.translated方法的典型用法代码示例。如果您正苦于以下问题:Python QLineF.translated方法的具体用法?Python QLineF.translated怎么用?Python QLineF.translated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.QLineF
的用法示例。
在下文中一共展示了QLineF.translated方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _updateTextAnchors
# 需要导入模块: from PyQt4.QtCore import QLineF [as 别名]
# 或者: from PyQt4.QtCore.QLineF import translated [as 别名]
def _updateTextAnchors(self):
n = len(self._items)
items = self._items
dist = 15
shape = reduce(QPainterPath.united, [item.path() for item in items])
brect = shape.boundingRect()
bradius = max(brect.width() / 2, brect.height() / 2)
center = self.boundingRect().center()
anchors = _category_anchors(items)
self._textanchors = []
for angle, anchor_h, anchor_v in anchors:
line = QLineF.fromPolar(bradius, angle)
ext = QLineF.fromPolar(dist, angle)
line = QLineF(line.p1(), line.p2() + ext.p2())
line = line.translated(center)
anchor_pos = line.p2()
self._textanchors.append((anchor_pos, anchor_h, anchor_v))
for i in range(n):
self._updateTextItemPos(i)