Direct swipe support for C++ widgets
-
Does anyone know if C++ widgets for Qt5 directly support touch gestures on mobile devices? I realize they are detected using QScroller, etc. but I would expect they would be directly supported for scroll widgets etc. by simply enabling them. Swipe scrolling is directly and automatically supported for C++ list displays but not when scrolling in text editors, etc. QML controls directly support these gestures but C++ widgets don’t seem to. Is this correct and will they be directly supported at some point if they aren’t?
-
QWidgets should support gestures since Qt 4.6.
you need to call grabGesture() on the widget in order to receive a gesture event:
@
widget->grabGesture(Qt::SwipeGesture);
@I don't think that all widgets are implementing gestures correctly by default, e.g. like you said scrolling in text editors. You would have "implement":http://qt-project.org/doc/qt-4.8/gestures-overview.html this yourself. Or use QScroller when possible (in Qt 5).
-
Thanks for responding. I had seen this reference but haven’t had luck using it. Will this actually enable Gestures for a widget or just enable the capturing of events? QML allows enabling Gestures very easily and touch scrolling in C++ is automatically supported for menu displays.
I ran the Gestures example which “enabled” the Gesture commands as given in your reference article but it didn’t work. It just seems that it would be simple to just globally turn on Gestures in C++ since they’re obviously already supported.