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. grapGesture - QScrollArea scroll with 1 Finger touch
Forum Updated to NodeBB v4.3 + New Features

grapGesture - QScrollArea scroll with 1 Finger touch

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 2 Posters 3.6k Views 2 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

    Hello,
    I found this way

    QScroller::grabGesture(ui->scrollArea, QScroller::LeftMouseButtonGesture);
    

    to avoid the annoying 2-Finger scroll. With this code I can scroll with one Finger.

    But I found a problem.
    When I click on a QPushButton in this scrollarea to open a new Dialog with an other one-Finger-ScrollArea in it, the scrolling does not work here.
    When I disable the one-Finger scrolling in first area with the Button it, the second dialog works.
    Only one grabGesture possible - must I disable it - on disabeling in the first Dialog in the on click even the app crashes after I close the 2. Dialog ????????????

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Andy314 said:

      QScroller::grabGesture

      hii
      what you u also call
      QScroller::grabGesture
      for the second
      one-Finger-ScrollArea ?

      Andy314A 2 Replies Last reply
      0
      • mrjjM mrjj

        @Andy314 said:

        QScroller::grabGesture

        hii
        what you u also call
        QScroller::grabGesture
        for the second
        one-Finger-ScrollArea ?

        Andy314A Offline
        Andy314A Offline
        Andy314
        wrote on last edited by
        #3

        Yes, of course !

        1 Reply Last reply
        0
        • mrjjM mrjj

          @Andy314 said:

          QScroller::grabGesture

          hii
          what you u also call
          QScroller::grabGesture
          for the second
          one-Finger-ScrollArea ?

          Andy314A Offline
          Andy314A Offline
          Andy314
          wrote on last edited by Andy314
          #4

          When I move the Button which calls the 2. Dialog out of the scrolling area, all works.
          So calling a scrollarea from an other scroll area is not posssible.
          Maybe in the _clicked event processing the gesture processing is in work and prevents other gesture processings ?
          What can I do ?

          Addition:
          I have checked my thesis.
          In the Button onClicked I start a timer in 100 ms .
          In the timer-even I open the 2. dialog -> it works.

          Hm, a little bit roundabout ! Is there an more easy and direct way ?

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            well
            when you open this dialog, do you call exec() ?
            That will start a local event loop and it might be the reason.

            Andy314A 1 Reply Last reply
            0
            • mrjjM mrjj

              well
              when you open this dialog, do you call exec() ?
              That will start a local event loop and it might be the reason.

              Andy314A Offline
              Andy314A Offline
              Andy314
              wrote on last edited by
              #6

              Yes, I start a modal dialog with exec !

              mrjjM 1 Reply Last reply
              0
              • Andy314A Andy314

                Yes, I start a modal dialog with exec !

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Andy314
                ok, that might do strange stuff as it stays in there.
                try calling show() instead to test

                note, show() dont block so if u have code

                dia.exec()
                code that do something with dialog stuff after OK

                switching to show() wont work.

                Andy314A 1 Reply Last reply
                0
                • mrjjM mrjj

                  @Andy314
                  ok, that might do strange stuff as it stays in there.
                  try calling show() instead to test

                  note, show() dont block so if u have code

                  dia.exec()
                  code that do something with dialog stuff after OK

                  switching to show() wont work.

                  Andy314A Offline
                  Andy314A Offline
                  Andy314
                  wrote on last edited by
                  #8

                  @mrjj
                  Indeed with show it works.

                  Any ideas how perform it with exec ?

                  mrjjM 1 Reply Last reply
                  0
                  • Andy314A Andy314

                    @mrjj
                    Indeed with show it works.

                    Any ideas how perform it with exec ?

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @Andy314
                    Only as you self discovered to use a timer to
                    start it via other signal.

                    Andy314A 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      @Andy314
                      Only as you self discovered to use a timer to
                      start it via other signal.

                      Andy314A Offline
                      Andy314A Offline
                      Andy314
                      wrote on last edited by
                      #10

                      @mrjj
                      Thank you for you help, here is my short solution:

                      QMetaObject::invokeMethod(this, "functionToCall", Qt::QueuedConnection);
                      
                      mrjjM 1 Reply Last reply
                      1
                      • Andy314A Andy314

                        @mrjj
                        Thank you for you help, here is my short solution:

                        QMetaObject::invokeMethod(this, "functionToCall", Qt::QueuedConnection);
                        
                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @Andy314 said:

                        QueuedConnection

                        ah, yes. i wondered if it would work.
                        And it does. super.

                        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