Qt World Summit: Submit your Presentation

touch-scrolling a custom widget and double-click

  • 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. 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.

    To enable gesture-scrolling, I call QScroller::grabGesture, in a sequence like the following:
    m_gridWidget = new GridWidget;
    QScrollArea * scroller = dynamic_cast<QScrollArea *>( centralWidget() );
    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, QLabels inside the gridWidget get to see clicks, but custom widgets inside the gridWidgets do not see double-clicks.

    How can I get this to work on Android? I am currently using QT 5.5 and testing on Android 5.0.2.

  • Would anyone like to recommend a better place to post this type of question?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    That might be a bug in the Android implementation. You can try asking on the Qt android development mailing list. You'll find there Qt Android port developers/maintainers (this forum is more user oriented)

Log in to reply