<?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[Qt Touch and Gesture related questions.]]></title><description><![CDATA[<p dir="auto">Hi Guys,</p>
<p dir="auto">I'm relatively new to Qt, been working in the touch domain for a few months and just picked up Qt as a possible application framework for  multi-touch based applications. The first thing I noticed which caused me some grief is that when running the PinchZoom example code from within  QtCreator through what I believe is called the simulator, the zooming / pinch would not work. However everything works fine when I run it through  the terminal after a "make" and "./pinchzoom". What is happening here that causes these touch events to be treated differently in these two  different environments? It simply doesn't seem to create the correct events in the simulator.</p>
<p dir="auto">The second curiosity I noticed was that Qt has a gesture recognizer which can be subscribed to using the grabGesture(Qt::PinchGesture); syntax.  Odd that there is a gesture recognizer but it is not used for the pinchzoom example. So I attempted to make use of it for my own pinchzoom  application which incorporates a subclassed QGraphicsView with a jpg in the scene allowing the user to scroll around the image (its larger than  the GraphicsView) and to zoom in or out using a two finger pinch gesture.</p>
<p dir="auto">So I set up to listen to 3 gestures:<br />
viewport()-&gt;grabGesture(Qt::PanGesture);<br />
viewport()-&gt;grabGesture(Qt::PinchGesture);<br />
viewport()-&gt;grabGesture(Qt::SwipeGesture);</p>
<p dir="auto">and then caught them and printed some information to see exactly when they were triggered</p>
<p dir="auto">if (QGesture *swipe = event-&gt;gesture(Qt::SwipeGesture))<br />
qDebug() &lt;&lt; "Swipe gesture detected";<br />
else if (QGesture *pan = event-&gt;gesture(Qt::PanGesture))<br />
qDebug() &lt;&lt; pan gesture detected";<br />
if (QGesture *pinch = event-&gt;gesture(Qt::PinchGesture))<br />
qDebug() &lt;&lt; pinch gesture detected";</p>
<p dir="auto">Running this, I noticed a few things. Firstly I could never seem to trigger a swipe gesture. The "swipe gesture" must be something different to  that in my mental model. The other oddity was that a PanGesture was some sort of two finger gesture that was triggered along with a pinch gesture  every time i moved with two touch events. Both of these gestures seemed to be recognized and triggered at the same time. This was somewhat  annoying as when performing a pinch i didn't want to be "panning". Im not even sure what "panning" is any more or "swipeing".</p>
<p dir="auto">So I have a few questions</p>
<p dir="auto">I am using the sample code from PinchZoom to handle my two finger zooming ability. Should I replace this with a gesture recognizer and attempt to  manage both pinch and pan events?</p>
<p dir="auto">Is a pan essentially "scrolling" as a user can do with the mouse by clicking, holding and moving their mouse around the graphics view? I am  implementing this feature by using one finger panning with the following code after catching a recognizing a QEvent as a TouchEvent in the  viewPort of my QGraphicsView.</p>
<p dir="auto">if (touchPoints.count() == 1)<br />
return false;</p>
<p dir="auto">This seems to then be sending the event off somewhere else to be dealt with as a mouse event.</p>
<p dir="auto">There doesn't seem to be a rotate gestureShould I implement this or is there sample code of a rotate?</p>
<p dir="auto">What is a Swipe gesture, I couldn't seem to get one recognized.</p>
<p dir="auto">Regards,<br />
Mitch.</p>
]]></description><link>https://forum.qt.io/topic/30506/qt-touch-and-gesture-related-questions</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 10:47:05 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/30506.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Aug 2013 09:06:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Qt Touch and Gesture related questions. on Wed, 14 Aug 2013 20:12:56 GMT]]></title><description><![CDATA[<p dir="auto">Hi and welcome to devnet,</p>
<p dir="auto">I haven't seen many touch/gesture relate posts that went so "low-level", you might want to try asking on the interest mailing list, there you'll find Qt's developers/maintainers (this forum is more user oriented)</p>
]]></description><link>https://forum.qt.io/post/191071</link><guid isPermaLink="true">https://forum.qt.io/post/191071</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 14 Aug 2013 20:12:56 GMT</pubDate></item></channel></rss>