mirror of
https://github.com/wassname/sloth.git
synced 2026-07-19 11:28:06 +08:00
add flag for allowing out of scene events
This commit is contained in:
+5
-4
@@ -137,10 +137,11 @@ class AnnotationScene(QGraphicsScene):
|
||||
def mousePressEvent(self, event):
|
||||
if self.debug_:
|
||||
print "mousePressEvent", self.sceneRect().contains(event.scenePos()), event.scenePos()
|
||||
if not self.sceneRect().contains(event.scenePos()):
|
||||
# ignore events outside the scene rect
|
||||
return
|
||||
elif self.inserter_ is not None:
|
||||
if self.inserter_ is not None:
|
||||
if not self.sceneRect().contains(event.scenePos()) and \
|
||||
not self.inserter_.allowOutOfSceneEvents():
|
||||
# ignore events outside the scene rect
|
||||
return
|
||||
# insert mode
|
||||
self.inserter_.mousePressEvent(event, self.root_)
|
||||
else:
|
||||
|
||||
@@ -29,6 +29,9 @@ class ItemInserter:
|
||||
def keyPressEvent(self, event, index):
|
||||
event.ignore()
|
||||
|
||||
def allowOutOfSceneEvents(self):
|
||||
return False
|
||||
|
||||
class PointItemInserter(ItemInserter):
|
||||
def mousePressEvent(self, event, index):
|
||||
pos = event.scenePos()
|
||||
|
||||
Reference in New Issue
Block a user