本文整理汇总了Python中PyQt4.QtGui.QGraphicsPolygonItem.setPos方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsPolygonItem.setPos方法的具体用法?Python QGraphicsPolygonItem.setPos怎么用?Python QGraphicsPolygonItem.setPos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QGraphicsPolygonItem
的用法示例。
在下文中一共展示了QGraphicsPolygonItem.setPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _add_selection
# 需要导入模块: from PyQt4.QtGui import QGraphicsPolygonItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsPolygonItem import setPos [as 别名]
def _add_selection(self, item):
"""Add selection rooted at item
"""
outline = self._selection_poly(item)
selection_item = QGraphicsPolygonItem(self)
# selection_item = QGraphicsPathItem(self)
selection_item.setPos(self.contentsRect().topLeft())
# selection_item.setPen(QPen(Qt.NoPen))
selection_item.setPen(make_pen(width=1, cosmetic=True))
transform = self._itemgroup.transform()
path = transform.map(outline)
margin = 4
if item.node.is_leaf:
path = QPolygonF(path.boundingRect()
.adjusted(-margin, -margin, margin, margin))
else:
pass
# ppath = QPainterPath()
# ppath.addPolygon(path)
# path = path_outline(ppath, width=margin).toFillPolygon()
selection_item.setPolygon(path)
# selection_item.setPath(path_outline(path, width=4))
selection_item.unscaled_path = outline
self._selection[item] = selection_item
item.setSelected(True)