Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions src/silx/gui/plot/backends/BackendMatplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1704,18 +1704,31 @@ def wheelEvent(self, event):
# Fix here as we want to be able to use alt modifier in silx plot.
# https://github.com/silx-kit/silx/pull/4631
if event.angleDelta().y() == 0:
event = qt.QWheelEvent(
event.position(),
event.globalPosition(),
event.pixelDelta(),
qt.QPoint(0, event.angleDelta().x()),
event.buttons(),
event.modifiers(),
event.phase(),
event.isInverted(),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here, there is no isInverted, it's inverted https://doc.qt.io/qt-6/qwheelevent.html#inverted-prop

event.source(),
event.pointingDevice(),
)
if qt.BINDING == "PyQt5":
event = qt.QWheelEvent(
event.position(),
event.globalPosition(),
event.pixelDelta(),
qt.QPoint(0, event.angleDelta().x()),
event.buttons(),
event.modifiers(),
event.phase(),
event.inverted(),
qt.Qt.MouseEventSynthesizedByApplication,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)
else:
event = qt.QWheelEvent(
event.position(),
event.globalPosition(),
event.pixelDelta(),
qt.QPoint(0, event.angleDelta().x()),
event.buttons(),
event.modifiers(),
event.phase(),
event.inverted(),
qt.Qt.MouseEventSynthesizedByApplication,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event.source() is obsolete in Qt6: https://doc.qt.io/qt-6/qmouseevent-obsolete.html#source, and so not available through PyQt6.
Though it works with PyQt5 and PySide6, I decided to do the same for all bindings (TBH I doubt it is ever retrieved).

event.pointingDevice(),
)
super().wheelEvent(event)
return

Expand Down
Loading