Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [SOLVED] QScroller doesn't work with QScrollArea (Android)
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 2 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    plinioandrade
    wrote on last edited by
    #1

    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,

    1 Reply Last reply
    0
    • P Offline
      P Offline
      plinioandrade
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

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

        (Z(:^

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved