diff options
Diffstat (limited to 'src/main/python/shapes')
-rw-r--r-- | src/main/python/shapes/line.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/python/shapes/line.py b/src/main/python/shapes/line.py index 310b496..216c2b5 100644 --- a/src/main/python/shapes/line.py +++ b/src/main/python/shapes/line.py @@ -302,3 +302,14 @@ class Line(QGraphicsPathItem): def setPenStyle(self, style): """change current pen style for line""" self.penStyle = style + + def __getstate__(self): + return { + "_classname_": self.__class__.__name__, + "startPoint": (self.startPoint.x(), self.startPoint.y()), + "endPoint": (self.endPoint.x(), self.endPoint.y()), + "points": [(point.x(), point.y()) for point in self.points] + } + + def __setstate__(self, dict): + self.points = [QPointF(x, y) for x, y in dict["points"]]
\ No newline at end of file |