Important: Please read the Qt Code of Conduct -

Swipe Gesture

  • Does anyone have an minimal example of the Swipe gesture working ? The gesture isn't being recognize even on the Qt example called imagegestures. I'm using Windows 8.

    I found a bug about this too (

    Thank you !

  • Bump. Bump.

  • Moderators

    well you already provided a bug-report that it is not working. If it's a trivial problem someone probably would have fixed it already or at least closed the bug.

    Did you verify that your screen supports multi-touch points and you have installed the drivers?

  • Yes I have support for multi-touch and the correct drivers, the other gestures are working, only Swipe isn't being recognized. But even if the screen is not multi-touch, the swipe is supposed to work because it uses only one touch, right ?

    In the bug I cited, there are only 4 votes and no answer from the development team since 2011 about it, it seems to me that the Qt testing team is doing a very poor quality work, how can a basic gesture not work on a release version of the platform ? It looks that they doesn't even tested their own example using the gesture that was supposed to work. I think that there is no way to solve this if not by re-implementing the gesture from scratch.

  • Moderators

    not necessarily... some screens just provide touch point pressings and releasing. But since the other gestures are working this isn't the issue.

    Did you verify that the swipe gesture is only not recognized in a Qt application?
    Meaning does the swipe gesture work in other windows applications?

  • Yes raven, thanks for the info, in other applications the gesture is working fine (like in the metro ui for instance).

  • I looked into the source code (qstandardgestures.cpp) and it seems that swipe uses 3 touch points, while on the docs it is showing an image with only one touch point. They don't even mention the three points in the docs, what a mess.

  • Moderators

    and now it works with 3 touch-points?

  • No, I'm only receiving pan, pinch and tap events, but not the Swipe. I tried with 3 fingers, with 4 fingers, slow, fast, no way to receive the gesture.

  • @tarantulae

    If you look at the docs of 5.0/4.8/4.7 I put a doc note at the end a year back with the same information that you listed above.

    The same is for QPanGesture that accepts 2 touch points. For our development we are using a custom class that subclasses QGestureRecognizer and handles both swipe and pan gesture with single touch.

    Tested on Windows and works very well.

    I'll add the doc note to 5.1 as well and may be we need to address this in the mailing list .

    For reference you can "check this":

  • Hello Sam, thanks for the information, I was going to start to implement the recognizer by myself and the referenced code will help a lot. Thanks again !

  • You are welcome,

    Try and test, i'll add my implementation to the WiKi sometime later which is extended from the same reference code but implements both swipe and pan with single touch !

  • I'll change the mouse events to touch points and then accept only Swipe, which is the only gesture that I'll need right now. Thanks !

  • Sam, have you also faced an issue that even using grab the object doesn't receive the gesture ? I'm triggering the gesture but even after calling grabGesture() it doesn't arrive.

  • Are you using setAttribute(Qt::WA_AcceptTouchEvents); attribute for your widget anywhere ?

    bq. Allows touch events (see QTouchEvent) to be sent to the widget. Must be set on all widgets that can handle touch events. Without this attribute set, events from a touch device will be sent as mouse events.

  • Yes, I'm using the WA_AcceptTouchEvents. I'll check it.

  • I'm definitively using WA_AcceptTouchEvents and also calling setAcceptTouchEvents(). The order of results being generated are: MayBeGesture, TriggerGesture and FinishGesture, but the gesture never arrive to the object. Do you know who is responsible by changing the QSwipeGesture::state() ? I'm always receiving Qt::NoGesture on the state too.

  • Could you share you implementation? just a small test example will be sufficient .


Log in to reply