Support for gestures like swiping in PyQt5
Frans Fürst
frans.fuerst at protonmail.com
Wed Feb 24 08:40:53 GMT 2021
I'm trying to make a PyQt5 application for Android react to swipe gestures (in order to let the user swipe through pictures). I didn't find much documentation about this (neither for C++ nor Python) but I came up with an approach which looks plausible to me:
class
MyViewer
(
QtWidgets.QLabel
):
def
__init__
(
self, parent=
None
):
super
().__init__(parent=parent)
self.grabGesture(QtCore.Qt.SwipeGesture)
def
event
(
self, event
):
if
event.
type
() == QtCore.QEvent.Gesture:
# <= this won't happen
print(
"Hello event!"
)
return
super
().event(event)
The app runs without errors but the event() method does not receive any events that look like gestures (at least on Android an Linux, but I don't know if I have to expect gestures work on Linux at all).
I've posted a question on StackOverflow, but with no answers yet: https://stackoverflow.com/questions/66304454/receive-gestures-in-pyqt5-for-android
Are there any known issues with gestures on Android with PyQt5?
Did I forget something important? Or am I on a totally wrong path here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210224/3ebb07cc/attachment.htm>
More information about the PyQt
mailing list