Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QScrollarea and touch
Forum Updated to NodeBB v4.3 + New Features

QScrollarea and touch

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 6.2k Views 3 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.
  • Andy314A Offline
    Andy314A Offline
    Andy314
    wrote on last edited by Andy314
    #1

    I want use the QScrollarea on a tablet. There are 2 main problems.

    1. Touch-Scrolling works only with 2 fingers.
      Is there a way to enable 1 finger scrolling for the scroll area to give it a consistent GUI for QML/Widget mixed apps.
    2. If I touch with 2 fingers on a QPushButton, scroll and then lift my fingers I get a clickEvent from the button, but I want only scrolling.

    Is there a solution for the problem ?

    1 Reply Last reply
    1
    • miclandM Offline
      miclandM Offline
      micland
      wrote on last edited by
      #2

      @Andy314
      I'm not sure if the following snippet solves your problem since I have no display near by - but in a project some years ago I setup the scrollArea as followed. Just try - and forget my conment if it does not work... ;-)

              // hide scrollbars
              scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
              scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
              // configure gesture and add rubberband effect
              QScroller::grabGesture(scrollArea, QScroller::LeftMouseButtonGesture);
      
      Andy314A 1 Reply Last reply
      3
      • miclandM micland

        @Andy314
        I'm not sure if the following snippet solves your problem since I have no display near by - but in a project some years ago I setup the scrollArea as followed. Just try - and forget my conment if it does not work... ;-)

                // hide scrollbars
                scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
                scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
                // configure gesture and add rubberband effect
                QScroller::grabGesture(scrollArea, QScroller::LeftMouseButtonGesture);
        
        Andy314A Offline
        Andy314A Offline
        Andy314
        wrote on last edited by
        #3

        Hello @micland,

        wow, it works and is so simple. Qt surprises again, there are certainly much more feature of Qt I dont know.

        Thank you very much for this tip, it solves a lot of problem for my project. :-)

        miclandM 1 Reply Last reply
        0
        • Andy314A Andy314

          Hello @micland,

          wow, it works and is so simple. Qt surprises again, there are certainly much more feature of Qt I dont know.

          Thank you very much for this tip, it solves a lot of problem for my project. :-)

          miclandM Offline
          miclandM Offline
          micland
          wrote on last edited by
          #4

          @Andy314
          Fine, you're welcome :)
          I remember I had a similiar problem years ago and found that snippet in one of the examples - but I was not sure if my problem was exactly the same that you had. Seems so...

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DaveK 0
            wrote on last edited by
            #5

            Have you tried using QScroller::grabGesture(scrollArea, QScroller::LeftMouseButtonGesture); on a QWidgets application with multiple QScrollAreas?

            Has that presented any problems for you?

            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