<?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[Swipe gesture in Android not working?]]></title><description><![CDATA[<p dir="auto">I am trying to make a application and I am trying out gestures, the funny thing is that Swipe gesture doesn't do anything. I made a basic new Qt MainWindow application with the following</p>
<p dir="auto">@MainWindow::MainWindow(QWidget *parent) :<br />
QMainWindow(parent),<br />
ui(new Ui::MainWindow)<br />
{<br />
ui-&gt;setupUi(this);<br />
grabGesture(Qt::SwipeGesture);<br />
grabGesture(Qt::TapGesture);<br />
grabGesture(Qt::TapAndHoldGesture);<br />
}</p>
<p dir="auto">bool MainWindow::event(QEvent <em>event){<br />
if (event-&gt;type() == QEvent::Gesture)<br />
return gestureEvent(static_cast&lt;QGestureEvent</em>&gt;(event));<br />
return QWidget::event(event);<br />
}</p>
<p dir="auto">bool MainWindow::gestureEvent(QGestureEvent *event){<br />
if (QGesture *swipe = event-&gt;gesture(Qt::SwipeGesture))<br />
swipeT(static_cast&lt;QSwipeGesture *&gt;(swipe));<br />
// commented out the tap gesture to check if tap and hold gesture works properly<br />
/<em>if(QGesture <em>tap=event-&gt;gesture(Qt::TapGesture))<br />
tapG(static_cast&lt;QTapGesture</em>&gt;(tap));</em>/<br />
if(QGesture <em>tapnh=event-&gt;gesture(Qt::TapAndHoldGesture))<br />
tapNH(static_cast&lt;QTapAndHoldGesture</em>&gt;(tapnh));<br />
return true;<br />
}</p>
<p dir="auto">void MainWindow::tapNH(QTapAndHoldGesture *gesture){<br />
if(gesture-&gt;state()==Qt::GestureFinished)<br />
QMessageBox::information(this,"Tap and Hold", "Merge");<br />
}</p>
<p dir="auto">void MainWindow::tapG(QTapGesture *gesture){<br />
if(gesture-&gt;state()==Qt::GestureFinished)<br />
QMessageBox::information(this,"Tap","Tap merge");<br />
}</p>
<p dir="auto">void MainWindow::swipeT(QSwipeGesture *gesture){<br />
if (gesture-&gt;state() == Qt::GestureFinished) {<br />
QMessageBox::information(this,"Swipe","Merge");<br />
//comented out direction to check if it is the direction that's causing the problem<br />
/<em>if (gesture-&gt;horizontalDirection() == QSwipeGesture::Left) {<br />
QMessageBox::information(this,"Swipe","Stanga");<br />
}<br />
else if(gesture-&gt;horizontalDirection()==QSwipeGesture::Right){<br />
QMessageBox::information(this,"Swipe","dreapta");<br />
}</em>/<br />
}<br />
}@</p>
<p dir="auto">I am testing it on a Android 2.3 tablet....and it has a multi touch screen.<br />
Using Qt 5.2.1 for Android, working on Ubuntu 14.04.</p>
<p dir="auto">Someone said on a post of mine that Qt gestures are a bit buggy, but surely there should be a fix/alternative way of achieving this, seeing how gestures are the main ways of navigating on a tablet/smartphone, can someone help me/point me in the right direction?</p>
]]></description><link>https://forum.qt.io/topic/43667/swipe-gesture-in-android-not-working</link><generator>RSS for Node</generator><lastBuildDate>Sun, 03 May 2026 07:40:22 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/43667.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 14 Jul 2014 13:58:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Swipe gesture in Android not working? on Mon, 14 Jul 2014 16:41:34 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for your guidance.</p>
]]></description><link>https://forum.qt.io/post/235792</link><guid isPermaLink="true">https://forum.qt.io/post/235792</guid><dc:creator><![CDATA[adutzu89]]></dc:creator><pubDate>Mon, 14 Jul 2014 16:41:34 GMT</pubDate></item><item><title><![CDATA[Reply to Swipe gesture in Android not working? on Mon, 14 Jul 2014 14:32:44 GMT]]></title><description><![CDATA[<p dir="auto">Much easier to use QtQuick module, then. But the QScroller sollution should still work, if you put your screens in a QScrollArea.</p>
]]></description><link>https://forum.qt.io/post/235776</link><guid isPermaLink="true">https://forum.qt.io/post/235776</guid><dc:creator><![CDATA[sierdzio]]></dc:creator><pubDate>Mon, 14 Jul 2014 14:32:44 GMT</pubDate></item><item><title><![CDATA[Reply to Swipe gesture in Android not working? on Mon, 14 Jul 2014 14:30:04 GMT]]></title><description><![CDATA[<p dir="auto">I will try your solution, thank you, though I will want to use swipe gesture to swipe through a series of widgets.</p>
]]></description><link>https://forum.qt.io/post/235775</link><guid isPermaLink="true">https://forum.qt.io/post/235775</guid><dc:creator><![CDATA[adutzu89]]></dc:creator><pubDate>Mon, 14 Jul 2014 14:30:04 GMT</pubDate></item><item><title><![CDATA[Reply to Swipe gesture in Android not working? on Mon, 14 Jul 2014 14:11:16 GMT]]></title><description><![CDATA[<p dir="auto">If you want gestures just to scroll some widgets, the easiest way is to use QScroller. All it requires is to add a single line to your code :-)</p>
]]></description><link>https://forum.qt.io/post/235772</link><guid isPermaLink="true">https://forum.qt.io/post/235772</guid><dc:creator><![CDATA[sierdzio]]></dc:creator><pubDate>Mon, 14 Jul 2014 14:11:16 GMT</pubDate></item></channel></rss>