From 67aa297beeec8eda038e05aeca97633641f1f917 Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Thu, 9 Sep 2021 15:14:51 +0200 Subject: [PATCH] schemeedit: Add mouse back/forward button navigation --- orangecanvas/document/schemeedit.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/orangecanvas/document/schemeedit.py b/orangecanvas/document/schemeedit.py index 739821980..ec15f8c51 100644 --- a/orangecanvas/document/schemeedit.py +++ b/orangecanvas/document/schemeedit.py @@ -1552,7 +1552,14 @@ def eventFilter(self, obj, event): elif etype == QEvent.GraphicsSceneDrop: return self.sceneDropEvent(event) elif etype == QEvent.GraphicsSceneMousePress: - self.__pasteOrigin = event.scenePos() + if event.button() == Qt.BackButton: + self.__historyStep(-1) + elif event.button() == Qt.ForwardButton: + self.__historyStep(1) + elif event.button() in ( + Qt.LeftButton, Qt.RightButton, Qt.MiddleButton + ): + self.__pasteOrigin = event.scenePos() return self.sceneMousePressEvent(event) elif etype == QEvent.GraphicsSceneMouseMove: return self.sceneMouseMoveEvent(event) @@ -1733,8 +1740,8 @@ def sceneMouseDoubleClickEvent(self, event): return False item = scene.item_at(event.scenePos()) - if not item and self.__quickMenuTriggers & \ - SchemeEditWidget.DoubleClicked: + if not item and event.button() == Qt.LeftButton and \ + self.__quickMenuTriggers & SchemeEditWidget.DoubleClicked: # Double click on an empty spot # Create a new node using QuickMenu action = interactions.NewNodeAction(self)