[Android-development] touch-scrolling a custom widget and double-click

Michael Coffey xaffeine-m at yahoo.com
Sat Jul 25 19:08:38 CEST 2015


I have developed a widget-based application that works well in linux and Windows. It mostly works in Android, too, but I haven't been able to get scrolling to work right.


Most of my UI is inside a custom subclass of QWidget called GridWidget. This widget sits inside of a QScrollArea, which is also the central widget of my QMainWindow. I have a pointer variable, m_gridWidget, pointing to this custom widget. Some of the children of my GridWidget need to be double-clickable. The GridWidget, itself, needs to flick-scroll.

To enable gesture-scrolling, I call QScroller::grabGesture, in a sequence like the following:
QScrollArea * scroller = new QScrollArea();
setCentralWidget( scroller );
m_gridWidget = new GridWidget;
scroller->setWidget( m_gridWidget );
QScroller::grabGesture( centralWidget() );
The grabGesture() does enable scrolling but it disables double-clicks on most of the children of the gridWidget. Interestingly, child widgets inside the gridWidget get to see clicks, but they do not see double-clicks. I have a workaround for that subproblem by implementing mouseReleaseEvent for a child widget class.
More importantly, flick-scrolling the main widget only works in the part of the widget where there are no child widgets. I want to be able to initiate the gesture anywhere in the region.

How can I get this to work on Android? I am currently using QT 5.5 and testing on Android 5.0.2.
   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20150725/174c2264/attachment.html>


More information about the Android-development mailing list