本文整理汇总了Python中PySide.QtGui.QPainterPath.setElementPositionAt方法的典型用法代码示例。如果您正苦于以下问题:Python QPainterPath.setElementPositionAt方法的具体用法?Python QPainterPath.setElementPositionAt怎么用?Python QPainterPath.setElementPositionAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QPainterPath
的用法示例。
在下文中一共展示了QPainterPath.setElementPositionAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PolylineObject
# 需要导入模块: from PySide.QtGui import QPainterPath [as 别名]
# 或者: from PySide.QtGui.QPainterPath import setElementPositionAt [as 别名]
#.........这里部分代码省略.........
def findIndex(self, point):
"""
TOWRITE
:param `point`: TOWRITE
:type `point`: `QPointF`_
:rtype: int
"""
elemCount = self.normalPath.elementCount() # int
# NOTE: Points here are in item coordinates
itemPoint = self.mapFromScene(point) # QPointF
for i in range(0, elemCount): # for(int i = 0; i < elemCount; i++)
e = self.normalPath.elementAt(i) # QPainterPath::Element
elemPoint = QPointF(e.x, e.y) # QPointF
if itemPoint == elemPoint:
return i
return -1
def gripEdit(self, before, after):
"""
TOWRITE
:param `before`: TOWRITE
:type `before`: `QPointF`_
:param `after`: TOWRITE
:type `after`: `QPointF`_
"""
self.gripIndex = self.findIndex(before)
if self.gripIndex == -1:
return
a = self.mapFromScene(after) # QPointF
self.normalPath.setElementPositionAt(self.gripIndex, a.x(), a.y())
self.updatePath(self.normalPath)
self.gripIndex = -1
def objectCopyPath(self):
"""
TOWRITE
:rtype: `QPainterPath`_
"""
return self.normalPath
def objectSavePath(self):
"""
TOWRITE
:rtype: `QPainterPath`_
"""
s = self.scale() # qreal
trans = QTransform()
trans.rotate(self.rotation())
trans.scale(s, s)
return trans.map(self.normalPath)
def objectPos(self):
"""
TOWRITE
:return: TOWRITE
:rtype: `QPointF`_
"""
return self.scenePos()