summaryrefslogtreecommitdiff
path: root/src/main/python/shapes
diff options
context:
space:
mode:
authorsumit2020-06-10 09:48:04 +0530
committersumit2020-06-10 09:48:04 +0530
commitbb2319bfa22adf49acaf0123ea9589fab5c8469a (patch)
treed99122f656385da8898e966db58830dc156adea1 /src/main/python/shapes
parent6772ab7c10214b816b74d36b37d8ddf68230da5a (diff)
downloadChemical-PFD-bb2319bfa22adf49acaf0123ea9589fab5c8469a.tar.gz
Chemical-PFD-bb2319bfa22adf49acaf0123ea9589fab5c8469a.tar.bz2
Chemical-PFD-bb2319bfa22adf49acaf0123ea9589fab5c8469a.zip
update line grip item when it's line removed
Diffstat (limited to 'src/main/python/shapes')
-rw-r--r--src/main/python/shapes/line.py6
-rw-r--r--src/main/python/shapes/shapes.py5
2 files changed, 6 insertions, 5 deletions
diff --git a/src/main/python/shapes/line.py b/src/main/python/shapes/line.py
index 268b750..0e56009 100644
--- a/src/main/python/shapes/line.py
+++ b/src/main/python/shapes/line.py
@@ -809,6 +809,12 @@ class Line(QGraphicsPathItem):
for line in self.midLines:
if line.scene():
line.scene().removeItem(line)
+ if self.startGripItem and self.startGripItem.line and not self.startGripItem.tempLine:
+ self.startGripItem.line = None
+ if self.endGripItem and self.endGripItem.line:
+ self.endGripItem.line = None
+ if self.refLine:
+ if self in self.refLine.midLines: self.refLine.midLines.remove(self)
return super(Line, self).itemChange(change, value)
diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py
index fe92938..0358898 100644
--- a/src/main/python/shapes/shapes.py
+++ b/src/main/python/shapes/shapes.py
@@ -240,9 +240,6 @@ class LineGripItem(GripItem):
if mouseEvent.button() != Qt.LeftButton:
return
# initialize a line and add on scene
- if self.line and not self.line.scene():
- self.line = None
-
if not self.line:
startPoint = endPoint = self.parentItem().mapToScene(self.pos())
self.tempLine = Line(startPoint, endPoint)
@@ -277,8 +274,6 @@ class LineGripItem(GripItem):
items = self.scene().items(QPointF(mouseEvent.scenePos().x(), mouseEvent.scenePos().y()))
for item in items:
if type(item) == LineGripItem and item != self:
- if item.line and not item.line.scene():
- item.line = None
if item.line:
break
self.tempLine.setStartGripItem(self)