Check if items having events sent to are still in the scene (#919)
Check if items having events sent to are still in the scene
This commit is contained in:
parent
9b8ef188a5
commit
2f4ac51a11
@ -263,7 +263,8 @@ class GraphicsScene(QtGui.QGraphicsScene):
|
|||||||
for item in prevItems:
|
for item in prevItems:
|
||||||
event.currentItem = item
|
event.currentItem = item
|
||||||
try:
|
try:
|
||||||
item.hoverEvent(event)
|
if item.scene() is self:
|
||||||
|
item.hoverEvent(event)
|
||||||
except:
|
except:
|
||||||
debug.printExc("Error sending hover exit event:")
|
debug.printExc("Error sending hover exit event:")
|
||||||
finally:
|
finally:
|
||||||
@ -288,7 +289,7 @@ class GraphicsScene(QtGui.QGraphicsScene):
|
|||||||
else:
|
else:
|
||||||
acceptedItem = None
|
acceptedItem = None
|
||||||
|
|
||||||
if acceptedItem is not None:
|
if acceptedItem is not None and acceptedItem.scene() is self:
|
||||||
#print "Drag -> pre-selected item:", acceptedItem
|
#print "Drag -> pre-selected item:", acceptedItem
|
||||||
self.dragItem = acceptedItem
|
self.dragItem = acceptedItem
|
||||||
event.currentItem = self.dragItem
|
event.currentItem = self.dragItem
|
||||||
@ -435,6 +436,8 @@ class GraphicsScene(QtGui.QGraphicsScene):
|
|||||||
for item in items:
|
for item in items:
|
||||||
if hoverable and not hasattr(item, 'hoverEvent'):
|
if hoverable and not hasattr(item, 'hoverEvent'):
|
||||||
continue
|
continue
|
||||||
|
if item.scene() is not self:
|
||||||
|
continue
|
||||||
shape = item.shape() # Note: default shape() returns boundingRect()
|
shape = item.shape() # Note: default shape() returns boundingRect()
|
||||||
if shape is None:
|
if shape is None:
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user