<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Python &#x2F; PySide6 - swipe gesture?]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">Does anyone have a reasonable example of capturing / processing a swipe gesture event within a pyside6/python program that I can use?   (I've got a main window created using Designer, containing a number of widgets, including buttons, list and WebEngine view.</p>
<p dir="auto">I've been googling/trying all morning and seem to have gotten nowhere... :-/</p>
<p dir="auto">Using Python3.14 / Pyside 6.11</p>
<p dir="auto">Many Thanks<br />
Carl.</p>
]]></description><link>https://forum.qt.io/topic/164742/python-pyside6-swipe-gesture</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 04:11:05 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164742.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Jun 2026 02:19:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Python &#x2F; PySide6 - swipe gesture? on Sun, 07 Jun 2026 08:45:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/carlb">@<bdi>CarlB</bdi></a> said in <a href="/post/838616">Python / PySide6 - swipe gesture?</a>:</p>
<blockquote>
<p dir="auto">Hi<br />
Ok - While the test program generates loads of output, unfortunately its still not recognising a swipe...   I did note that your example is using PyQT6, I hadn't mentioned that I'm using PySide6 - however, I believe that they should be compatible.</p>
</blockquote>
<p dir="auto">I don't expect a difference either. The first version was written in C++, and no PyQt-specific changes were required to port it.</p>
<blockquote>
<p dir="auto">Meanwhile - I opened the program, did a <em>very</em> quick swipe right to left, and here's the output:</p>
<pre><code>qt.widgets.gestures: QGestureManager:Recognizer: maybe gesture:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchBegin device: "" states: Pressed, 1 points: QList(QEventPoint(id=0 ts=92554578 pos=429.5,265 scn=829.5,481 gbl=829.5,481 Pressed pressure=0.5 ellipse=(65.5x84.5 ? 0) vel=0,0 press=429.5,265 last=429.5,265 ? 0,0)))
qt.widgets.gestures: QGestureManager::filterEventThroughContexts: 
        activeGestures: QSet() 
        maybeGestures: QSet(QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0)) 
        started: QSet() 
        triggered: QSet() 
        finished: QSet() 
        canceled: QSet() 
        maybe-canceled: QSet()
qt.widgets.gestures: QGestureManager:Recognizer: maybe gesture:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchBegin device: "" states: Pressed, 1 points: QList(QEventPoint(id=0 ts=92554578 pos=429.5,265 scn=829.5,481 gbl=829.5,481 Pressed pressure=0.5 ellipse=(65.5x84.5 ? 0) vel=0,0 press=429.5,265 last=429.5,265 ? 0,0)))
qt.widgets.gestures: QGestureManager::filterEventThroughContexts: 
        activeGestures: QSet() 
        maybeGestures: QSet(QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0)) 
        started: QSet() 
        triggered: QSet() 
        finished: QSet() 
        canceled: QSet() 
        maybe-canceled: QSet()
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchUpdate device: "" states: Updated, 1 points: QList(QEventPoint(id=0 ts=92554578 pos=418,266 scn=818,482 gbl=818,482 Updated pressure=0.5 ellipse=(65.5x84.5 ? 0) vel=0,0 press=429.5,265 last=429.5,265 ? -11.5,1)))
</code></pre>
</blockquote>
<p dir="auto">The swipe gesture recognizer starts out by indicating that the first two events might be related to a swipe, so we know that the right type of input is being received. Changing touch input settings is apparently not warranted. It then switches to ignoring the events, before eventually declaring "not gesture". Looking at  <a href="https://codebrowser.dev/qt6/qtbase/src/widgets/kernel/qstandardgestures.cpp.html#282" target="_blank" rel="noopener noreferrer nofollow ugc">QSwipeGestureRecognizer::recognize</a> , there's a state change that occurs when 3 touch points are present.</p>
<pre><code>        else if (ev-&gt;points().size() == 3) {
            d-&gt;state = QSwipeGesturePrivate::ThreePointsReached;
</code></pre>
<p dir="auto">The attempted swipe in the logs above appears to be limited to a single touch point. Does a 3 finger swipe generate substantially different output?</p>
]]></description><link>https://forum.qt.io/post/838617</link><guid isPermaLink="true">https://forum.qt.io/post/838617</guid><dc:creator><![CDATA[jeremy_k]]></dc:creator><pubDate>Sun, 07 Jun 2026 08:45:27 GMT</pubDate></item><item><title><![CDATA[Reply to Python &#x2F; PySide6 - swipe gesture? on Sun, 07 Jun 2026 02:34:17 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
Ok - While the test program generates loads of output, unfortunately its still not recognising a swipe...   I did note that your example is using PyQT6, I hadn't mentioned that I'm using PySide6 - however, I believe that they should be compatible.</p>
<p dir="auto">As I'm only interested in swipes, I removed the other gesture types from the list, so I peared down the program to:</p>
<pre><code>from PySide6.QtWidgets import QApplication, QWidget
from PySide6.QtCore import QEvent, QLoggingCategory, Qt

class Widget(QWidget):
    def event(self, e: QEvent) -&gt; bool:
        if QEvent.Type.Gesture == e.type():
            print(f"Gesture delivered: {e.gestures()}")
        return super().event(e)

app = QApplication([])
QLoggingCategory.setFilterRules("qt.widgets.gestures=true")
w = Widget()


w.grabGesture(Qt.GestureType.SwipeGesture)
w.show()
app.exec()

</code></pre>
<p dir="auto">Meanwhile - I opened the program, did a <em>very</em> quick swipe right to left, and here's the output:</p>
<pre><code>qt.widgets.gestures: QGestureManager:Recognizer: maybe gesture:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchBegin device: "" states: Pressed, 1 points: QList(QEventPoint(id=0 ts=92554578 pos=429.5,265 scn=829.5,481 gbl=829.5,481 Pressed pressure=0.5 ellipse=(65.5x84.5 ? 0) vel=0,0 press=429.5,265 last=429.5,265 ? 0,0)))
qt.widgets.gestures: QGestureManager::filterEventThroughContexts: 
        activeGestures: QSet() 
        maybeGestures: QSet(QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0)) 
        started: QSet() 
        triggered: QSet() 
        finished: QSet() 
        canceled: QSet() 
        maybe-canceled: QSet()
qt.widgets.gestures: QGestureManager:Recognizer: maybe gesture:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchBegin device: "" states: Pressed, 1 points: QList(QEventPoint(id=0 ts=92554578 pos=429.5,265 scn=829.5,481 gbl=829.5,481 Pressed pressure=0.5 ellipse=(65.5x84.5 ? 0) vel=0,0 press=429.5,265 last=429.5,265 ? 0,0)))
qt.widgets.gestures: QGestureManager::filterEventThroughContexts: 
        activeGestures: QSet() 
        maybeGestures: QSet(QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0)) 
        started: QSet() 
        triggered: QSet() 
        finished: QSet() 
        canceled: QSet() 
        maybe-canceled: QSet()
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchUpdate device: "" states: Updated, 1 points: QList(QEventPoint(id=0 ts=92554578 pos=418,266 scn=818,482 gbl=818,482 Updated pressure=0.5 ellipse=(65.5x84.5 ? 0) vel=0,0 press=429.5,265 last=429.5,265 ? -11.5,1)))
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchUpdate device: "" states: Updated, 1 points: QList(QEventPoint(id=0 ts=92554578 pos=418,266 scn=818,482 gbl=818,482 Updated pressure=0.5 ellipse=(65.5x84.5 ? 0) vel=0,0 press=429.5,265 last=429.5,265 ? -11.5,1)))
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchUpdate device: "" states: Updated, 1 points: QList(QEventPoint(id=0 ts=92554578 pos=405,266.5 scn=805,482.5 gbl=805,482.5 Updated pressure=0.5 ellipse=(65.5x84 ? 0) vel=0,0 press=429.5,265 last=418,266 ? -13,0.5)))
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchUpdate device: "" states: Updated, 1 points: QList(QEventPoint(id=0 ts=92554578 pos=405,266.5 scn=805,482.5 gbl=805,482.5 Updated pressure=0.5 ellipse=(65.5x84 ? 0) vel=0,0 press=429.5,265 last=418,266 ? -13,0.5)))
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseMove pos=429.5,265 scn=429.5,265 gbl=829.5,481 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseMove pos=429.5,265 scn=429.5,265 gbl=829.5,481 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseButtonPress LeftButton pos=429.5,265 scn=429.5,265 gbl=829.5,481 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseButtonPress LeftButton pos=429.5,265 scn=429.5,265 gbl=829.5,481 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseMove btns=LeftButton pos=405,266.5 scn=405,266.5 gbl=805,482.5 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseMove btns=LeftButton pos=405,266.5 scn=405,266.5 gbl=805,482.5 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchUpdate device: "" states: Updated, 1 points: QList(QEventPoint(id=0 ts=92554593 pos=390,267 scn=790,483 gbl=790,483 Updated pressure=0.5 ellipse=(66x83.5 ? 0) vel=-700,23.3333 press=429.5,265 last=405,266.5 ? -15,0.5)))
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchUpdate device: "" states: Updated, 1 points: QList(QEventPoint(id=0 ts=92554593 pos=390,267 scn=790,483 gbl=790,483 Updated pressure=0.5 ellipse=(66x83.5 ? 0) vel=-700,23.3333 press=429.5,265 last=405,266.5 ? -15,0.5)))
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseMove btns=LeftButton pos=390,267 scn=390,267 gbl=790,483 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseMove btns=LeftButton pos=390,267 scn=390,267 gbl=790,483 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchUpdate device: "" states: Updated, 1 points: QList(QEventPoint(id=0 ts=92554593 pos=375.5,266 scn=775.5,482 gbl=775.5,482 Updated pressure=0.5 ellipse=(66x83 ? 0) vel=0,0 press=429.5,265 last=390,267 ? -14.5,-1)))
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchUpdate device: "" states: Updated, 1 points: QList(QEventPoint(id=0 ts=92554593 pos=375.5,266 scn=775.5,482 gbl=775.5,482 Updated pressure=0.5 ellipse=(66x83 ? 0) vel=0,0 press=429.5,265 last=390,267 ? -14.5,-1)))
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseMove btns=LeftButton pos=375.5,266 scn=375.5,266 gbl=775.5,482 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseMove btns=LeftButton pos=375.5,266 scn=375.5,266 gbl=775.5,482 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchUpdate device: "" states: Updated, 1 points: QList(QEventPoint(id=0 ts=92554609 pos=361.5,264 scn=761.5,480 gbl=761.5,480 Updated pressure=0.5 ellipse=(65x81 ? 0) vel=-612.5,-87.5 press=429.5,265 last=375.5,266 ? -14,-2)))
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchUpdate device: "" states: Updated, 1 points: QList(QEventPoint(id=0 ts=92554609 pos=361.5,264 scn=761.5,480 gbl=761.5,480 Updated pressure=0.5 ellipse=(65x81 ? 0) vel=-612.5,-87.5 press=429.5,265 last=375.5,266 ? -14,-2)))
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseMove btns=LeftButton pos=361.5,264 scn=361.5,264 gbl=761.5,480 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseMove btns=LeftButton pos=361.5,264 scn=361.5,264 gbl=761.5,480 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
qt.widgets.gestures: QGestureManager:Recognizer: not gesture:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchEnd device: "" states: Released, 1 points: QList(QEventPoint(id=0 ts=92554625 pos=361.5,264 scn=761.5,480 gbl=761.5,480 Released ellipse=(65x81 ? 0) vel=0,0 press=429.5,265 last=361.5,264 ? 0,0)))
qt.widgets.gestures: QGestureManager:Recognizer: not gesture:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QTouchEvent(TouchEnd device: "" states: Released, 1 points: QList(QEventPoint(id=0 ts=92554625 pos=361.5,264 scn=761.5,480 gbl=761.5,480 Released ellipse=(65x81 ? 0) vel=0,0 press=429.5,265 last=361.5,264 ? 0,0)))
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseButtonRelease LeftButton pos=361.5,264 scn=361.5,264 gbl=761.5,480 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
qt.widgets.gestures: QGestureManager:Recognizer: ignored the event:  QSwipeGesture(state=NoGesture,horizontalDirection=Right,verticalDirection=NoDirection,swipeAngle=0) QMouseEvent(MouseButtonRelease LeftButton pos=361.5,264 scn=361.5,264 gbl=761.5,480 dev=QInputDevice(QPointingDevice("" TouchScreen id=277 ptrType=Finger caps=Position|Area|NormalizedPosition|MouseEmulation buttonCount=1 maxPts=10 uniqueId=115)) source=MouseEventSynthesizedBySystem
</code></pre>
<p dir="auto">As per the end of each statement, I suspect touches are being turned into mouse events (the end of each line says 'source=MouseEventSynthesizedBySystem')</p>
<p dir="auto">Not sure why its doing that... or if there's a way to turn it off</p>
<p dir="auto">According to <a href="https://doc.qt.io/qtforpython-6/PySide6/QtGui/QTouchEvent.html:" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qtforpython-6/PySide6/QtGui/QTouchEvent.html:</a></p>
<p dir="auto">To receive touch events, widgets have to have the Qt::WA_AcceptTouchEvents attribute set and graphics items need to have the acceptTouchEvents attribute set to true.</p>
<p dir="auto">However, adding:<br />
w = Widget()<br />
w.setAttribute(Qt.WA_AcceptTouchEvents, True)</p>
<p dir="auto">Appears to have no effect...</p>
<p dir="auto">Any thoughts?</p>
]]></description><link>https://forum.qt.io/post/838616</link><guid isPermaLink="true">https://forum.qt.io/post/838616</guid><dc:creator><![CDATA[CarlB]]></dc:creator><pubDate>Sun, 07 Jun 2026 02:34:17 GMT</pubDate></item><item><title><![CDATA[Reply to Python &#x2F; PySide6 - swipe gesture? on Sat, 06 Jun 2026 06:08:42 GMT]]></title><description><![CDATA[<p dir="auto">Hi - Many thanks for the example - I'll give that a go :-)</p>
<p dir="auto">(I'm running on windows 11, surface pro 9 - developing under VS Code.)</p>
]]></description><link>https://forum.qt.io/post/838610</link><guid isPermaLink="true">https://forum.qt.io/post/838610</guid><dc:creator><![CDATA[CarlB]]></dc:creator><pubDate>Sat, 06 Jun 2026 06:08:42 GMT</pubDate></item><item><title><![CDATA[Reply to Python &#x2F; PySide6 - swipe gesture? on Fri, 05 Jun 2026 11:26:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/carlb">@<bdi>CarlB</bdi></a> said in <a href="/post/838598">Python / PySide6 - swipe gesture?</a>:</p>
<blockquote>
<p dir="auto">I've ended up installing event filter and capturing the mousebutton or touchevents and position start/end to work out the swipe...</p>
</blockquote>
<p dir="auto">The intended usage is to register a <a href="https://doc.qt.io/qt-6/qgesturerecognizer.html" target="_blank" rel="noopener noreferrer nofollow ugc">gesture recognizer</a>.</p>
<blockquote>
<p dir="auto">The annoying thing is that when I update the html, I have to re-install the eventfilter otherwise it won't respond to touch events...</p>
</blockquote>
<p dir="auto">How are you installing the event filter?</p>
<p dir="auto">What operating system, windowing system, and hardware are you using? A look at the source for <a href="https://codebrowser.dev/qt6/qtbase/src/widgets/kernel/qgesturemanager.cpp.html#57" target="_blank" rel="noopener noreferrer nofollow ugc">QGestureManager</a> shows different recognizers for macOS based platforms versus the default case.</p>
<p dir="auto">Also, are you able to trigger any other gestures?</p>
<p dir="auto">Voluminous gesture debugging:</p>
<pre><code>from PyQt6.QtWidgets import QApplication, QWidget
from PyQt6.QtCore import QEvent, QLoggingCategory, Qt

class Widget(QWidget):
    def event(self, e: QEvent) -&gt; bool:
        if QEvent.Type.Gesture == e.type():
            print(f"Gesture delivered: {e.gestures()}")
        return super().event(e)

app = QApplication([])
QLoggingCategory.setFilterRules("qt.widgets.gestures=true")
w = Widget()

for gesture in (Qt.GestureType.TapGesture,
                Qt.GestureType.TapAndHoldGesture,
                Qt.GestureType.PanGesture,
                Qt.GestureType.PinchGesture,
                Qt.GestureType.SwipeGesture):
    w.grabGesture(gesture)
w.show()
app.exec()
</code></pre>
<p dir="auto">On a mac, I have only been able to cause a <code>TapAndHoldGesture</code> with a mouse. With a touch pad, <code>PanGesture</code> is also easily triggered. I haven't had any luck so far with <code>PinchGesture</code> or <code>SwipeGesture</code>. The gesture manager source linked above tells me not to expect <code>TapGesture</code>.</p>
]]></description><link>https://forum.qt.io/post/838602</link><guid isPermaLink="true">https://forum.qt.io/post/838602</guid><dc:creator><![CDATA[jeremy_k]]></dc:creator><pubDate>Fri, 05 Jun 2026 11:26:23 GMT</pubDate></item><item><title><![CDATA[Reply to Python &#x2F; PySide6 - swipe gesture? on Fri, 05 Jun 2026 06:05:18 GMT]]></title><description><![CDATA[<p dir="auto">I've ended up installing event filter and capturing the mousebutton or touchevents and position start/end to work out the swipe...</p>
<p dir="auto">The annoying thing is that when I update the html, I have to re-install the eventfilter otherwise it won't respond to touch events... weird...</p>
<p dir="auto">In the init:<br />
```<br />
self.SwipeStatus=0<br />
self.SwipeXStart=0<br />
self.SwipeYStart=0<br />
self.SwipeXEnd=0<br />
self.SwipeYEnd=0</p>
<pre><code>    self.SongText.focusProxy().installEventFilter(self)
</code></pre>
<pre><code>
then:

    ```
def eventFilter(self, source, event):

        if event.type() == QEvent.Type.MouseButtonPress or event.type() == QEvent.Type.MouseMove or event.type() == QEvent.Type.MouseButtonRelease or event.type() == QEvent.Type.TouchBegin or event.type() == QEvent.Type.Leave or event.type() == QEvent.Type.TouchUpdate or event.type() == QEvent.Type.TouchEnd or event.type() == QEvent.Type.Enter:

            if event.type() == QEvent.Type.Leave:
                # print ("Noise: Leave")
                a=0
            if event.type() == QEvent.Type.TouchUpdate:
                # print ("Noise: TouchUpdate")
                a=0
            if event.type() == QEvent.Type.Enter:
                # print ("Noise: Enter")
                a=0

            if event.type() == QEvent.Type.MouseButtonPress or event.type() == QEvent.Type.TouchBegin:
                self.SwipeStatus=1
                if event.type() == QEvent.Type.MouseButtonPress:
                    self.SwipeXStart=event.globalPosition().x()
                    self.SwipeYStart=event.globalPosition().y()
                else:
                    self.SwipeXStart=event.point(0).position().x()
                    self.SwipeYStart=event.point(0).position().y()
                self.SwipeXEnd=0
                self.SwipeYEnd=0

            if event.type() == QEvent.Type.MouseMove:
                # dummy 
                a=0

            if event.type() == QEvent.Type.MouseButtonRelease  or event.type() == QEvent.Type.TouchEnd:
                
                if self.SwipeStatus == 1:
                    if event.type() == QEvent.Type.MouseButtonRelease:
                        self.SwipeXEnd=event.globalPosition().x()
                        self.SwipeYEnd=event.globalPosition().y()
                    else:
                        self.SwipeXEnd=event.point(0).position().x()
                        self.SwipeYEnd=event.point(0).position().y()

                    if abs(self.SwipeXEnd-self.SwipeXStart) &gt; abs(self.SwipeYEnd-self.SwipeYStart):
                        # Horizontal
                        if self.SwipeXStart &lt; self.SwipeXEnd:
                            print("Right to Left")
                        else:
                            print("Left to Right")
                     else:
                        print("Vertical")
                        if self.SwipeYStart &lt; self.SwipeYEnd:
                            print("Down")
                        else:
                            print("Up")

                    self.SwipeStatus=0
                else:
                    self.SwipeStatus=0
        else:
            self.SwipeStatus=0

        return super().eventFilter(source, event)
</code></pre>
]]></description><link>https://forum.qt.io/post/838598</link><guid isPermaLink="true">https://forum.qt.io/post/838598</guid><dc:creator><![CDATA[CarlB]]></dc:creator><pubDate>Fri, 05 Jun 2026 06:05:18 GMT</pubDate></item><item><title><![CDATA[Reply to Python &#x2F; PySide6 - swipe gesture? on Thu, 04 Jun 2026 06:00:32 GMT]]></title><description><![CDATA[<p dir="auto">Hi - Yep - I've had a look at that - but I couldn't get that one to work under python either - I had a similar problem with PyQt6/Python3.9 - I ended up coding my own swipe recognition routine with mousepress-mousemove-mouserelease - I've updated my code to be latest release using pyside - and at this point it looks like I'm going to end up doing the same thing - I would have preferred to do it the 'proper' way if poss... I even got example code generated by AI, and while it looked sensible, it didn't recognise the gesture...   I'm definately missing something...</p>
]]></description><link>https://forum.qt.io/post/838573</link><guid isPermaLink="true">https://forum.qt.io/post/838573</guid><dc:creator><![CDATA[CarlB]]></dc:creator><pubDate>Thu, 04 Jun 2026 06:00:32 GMT</pubDate></item><item><title><![CDATA[Reply to Python &#x2F; PySide6 - swipe gesture? on Wed, 03 Jun 2026 19:01:01 GMT]]></title><description><![CDATA[<p dir="auto">Hi and welcome to devnet,</p>
<p dir="auto">Not a Python example but did you consider translation the <a href="https://doc.qt.io/qt-6/qtwidgets-gestures-imagegestures-example.html" target="_blank" rel="noopener noreferrer nofollow ugc">Image Gestures example</a> ?</p>
]]></description><link>https://forum.qt.io/post/838570</link><guid isPermaLink="true">https://forum.qt.io/post/838570</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 03 Jun 2026 19:01:01 GMT</pubDate></item></channel></rss>