[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: Support for gestures like swiping in PyQt5
From: Giuseppe Corbelli <corbelligiuseppe () mesdan ! it>
Date: 2021-02-24 10:03:39
Message-ID: c4bca3ae-f182-c643-804f-2148ae1f36b0 () mesdan ! it
[Download RAW message or body]
On 2/24/21 9:40 AM, Frans Fürst wrote:
> 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
> <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?
As far as I can tell you're on the right path.
I assume you've started from
https://doc.qt.io/qt-5/gestures-overview.html
On a desktop platform it does not likely work out of the box:
https://stackoverflow.com/questions/49287314/qgestureevent-for-mouse
--
Giuseppe Corbelli
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic