本文整理汇总了Python中PySide.QtGui.QPainterPath.toReversed方法的典型用法代码示例。如果您正苦于以下问题:Python QPainterPath.toReversed方法的具体用法?Python QPainterPath.toReversed怎么用?Python QPainterPath.toReversed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QPainterPath
的用法示例。
在下文中一共展示了QPainterPath.toReversed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PolylineObject
# 需要导入模块: from PySide.QtGui import QPainterPath [as 别名]
# 或者: from PySide.QtGui.QPainterPath import toReversed [as 别名]
class PolylineObject(BaseObject):
"""
Subclass of `BaseObject`_
TOWRITE
.. sphinx_generate_methods_summary::
PolylineObject
"""
Type = OBJ_TYPE_POLYLINE
def __init__(self, x, y, p, rgb, parent=None):
#OVERLOADED IMPL?# PolylineObject::PolylineObject(PolylineObject* obj, QGraphicsItem* parent) : BaseObject(parent)
"""
Default class constructor.
:param `x`: TOWRITE
:type `x`: qreal
:param `y`: TOWRITE
:type `y`: qreal
:param `p`: TOWRITE
:type `p`: `QPainterPath`_
:param `rgb`: TOWRITE
:type `rgb`: QRgb
:param `parent`: TOWRITE
:type `parent`: `QGraphicsItem`_
"""
super(PolylineObject, self).__init__(parent)
qDebug("PolylineObject Constructor()")
self.normalPath = QPainterPath()
self.gripIndex = int()
self.init(x, y, p, rgb, Qt.SolidLine) # TODO: getCurrentLineType
#OVERLOADED IMPL?# if obj:
#OVERLOADED IMPL?# self.init(obj.objectX(), obj.objectY(), obj.objectCopyPath(), obj.objectColorRGB(), Qt.SolidLine) # TODO: getCurrentLineType
#OVERLOADED IMPL?# self.setRotation(obj.rotation())
#OVERLOADED IMPL?# self.setScale(obj.scale())
def __del__(self):
"""Class destructor."""
qDebug("PolylineObject Destructor()")
def init(self, x, y, p, rgb, lineType):
"""
TOWRITE
:param `x`: TOWRITE
:type `x`: qreal
:param `y`: TOWRITE
:type `y`: qreal
:param `p`: TOWRITE
:type `p`: `QPainterPath`_
:param `rgb`: TOWRITE
:type `rgb`: QRgb
:param `lineType`: TOWRITE
:type `lineType`: Qt.PenStyle
"""
self.setData(OBJ_TYPE, self.type())
self.setData(OBJ_NAME, OBJ_NAME_POLYLINE)
# WARNING: DO NOT enable QGraphicsItem::ItemIsMovable. If it is enabled,
# WARNING: and the item is double clicked, the scene will erratically move the item while zooming.
# WARNING: All movement has to be handled explicitly by us, not by the scene.
self.setFlag(QGraphicsItem.ItemIsSelectable, True)
self.gripIndex = -1
self.updatePath(p)
self.setObjectPos(x,y)
self.setObjectColorRGB(rgb)
self.setObjectLineType(lineType)
self.setObjectLineWeight(0.35) # TODO: pass in proper lineweight
self.setPen(self.objectPen())
def updatePath(self, p):
"""
TOWRITE
:param `p`: TOWRITE
:type `p`: `QPainterPath`_
"""
self.normalPath = p
reversePath = self.normalPath.toReversed() # QPainterPath
reversePath.connectPath(self.normalPath)
self.setObjectPath(reversePath)
def paint(self, painter, option, widget):
"""
TOWRITE
:param `painter`: TOWRITE
:type `painter`: `QPainter`_
:param `option`: TOWRITE
:type `option`: `QStyleOptionGraphicsItem`_
:param `widget`: TOWRITE
:type `widget`: `QWidget`_
#.........这里部分代码省略.........