From 4b5d97fa4d295eb30a04f551bd7486f880816f0d Mon Sep 17 00:00:00 2001 From: Jerome Drese Date: Tue, 1 Oct 2024 15:56:48 +0200 Subject: [PATCH] Fix AttributeError for API change on QWheelEvent from Qt5 --- NodeGraphQt/widgets/viewer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NodeGraphQt/widgets/viewer.py b/NodeGraphQt/widgets/viewer.py index 9de9bfbb..ccaf5a07 100644 --- a/NodeGraphQt/widgets/viewer.py +++ b/NodeGraphQt/widgets/viewer.py @@ -669,7 +669,11 @@ def wheelEvent(self, event): delta = event.angleDelta().y() if delta == 0: delta = event.angleDelta().x() - self._set_viewer_zoom(delta, pos=event.pos()) + try: + self._set_viewer_zoom(delta, pos=event.pos()) + except AttributeError: + # For PyQt5 and above + self._set_viewer_zoom(delta, pos=event.position().toPoint()) def dropEvent(self, event): pos = self.mapToScene(event.pos())