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,6 +263,7 @@ class GraphicsScene(QtGui.QGraphicsScene):
|
||||
for item in prevItems:
|
||||
event.currentItem = item
|
||||
try:
|
||||
if item.scene() is self:
|
||||
item.hoverEvent(event)
|
||||
except:
|
||||
debug.printExc("Error sending hover exit event:")
|
||||
@ -288,7 +289,7 @@ class GraphicsScene(QtGui.QGraphicsScene):
|
||||
else:
|
||||
acceptedItem = None
|
||||
|
||||
if acceptedItem is not None:
|
||||
if acceptedItem is not None and acceptedItem.scene() is self:
|
||||
#print "Drag -> pre-selected item:", acceptedItem
|
||||
self.dragItem = acceptedItem
|
||||
event.currentItem = self.dragItem
|
||||
@ -435,6 +436,8 @@ class GraphicsScene(QtGui.QGraphicsScene):
|
||||
for item in items:
|
||||
if hoverable and not hasattr(item, 'hoverEvent'):
|
||||
continue
|
||||
if item.scene() is not self:
|
||||
continue
|
||||
shape = item.shape() # Note: default shape() returns boundingRect()
|
||||
if shape is None:
|
||||
continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user