[SOLVED] QScroller doesn't work with QScrollArea (Android)



  • Hey everyone,
    I have a big issue here about QScroller and QScrollArea. I can't move the scrool area using touch events on Android. Looking for the documentation it says a should do:
    @QWidget *w = ...;
    QScroller::grabGesture(w, QScroller::LeftMouseButtonGesture);@

    It works fine with QTableWidget but when I'm using the QScrollArea it just doesn't work. I already set the Qt::WA_AcceptTouchEvents in the QScrollArea viewport. This is part of my code:
    @this->ui->scrollArea->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
    QScroller::grabGesture(this->ui->scrollArea->viewport(), QScroller::TouchGesture);@

    What is wrong? Can someone help me? Sincerely,



  • Hey every one. I figured out the problem. For some Reason the code
    @this->ui->scrollArea->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
    QScroller::grabGesture(this->ui->scrollArea->viewport(), QScroller::TouchGesture);@
    doesn't work for QScrollArea. Then I used a class called "FlickCharm":http://blog.qt.digia.com/blog/2008/11/15/flick-list-or-kinetic-scrolling/. It was developed by "Ariya Hidayat":http://blog.qt.digia.com/blog/author/ariya/ and it is working good now.
    Not satisfied I tried to use the QScroller again but this time with the parameter QScroller::LeftMouseButtonGesture that is:
    @QScroller::grabGesture(this->ui->scrollArea->viewport(), QScroller::LeftMouseButtonGesture);@
    and.... It works for Mouse Event and for Touch Event on my Samsumg Galaxy S4. Now I'm happy because I'm just using the native class QScroller and it's working so good. I hope to help more people in the same situation. Sincerely.


  • Moderators

    Thank you for this post, I've been battling the same issue recently :-)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.