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. QScroller prevent button click
Qt 6.11 is out! See what's new in the release blog

QScroller prevent button click

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 2.8k 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.
  • M Offline
    M Offline
    MajidKamali
    wrote on last edited by
    #1

    Hi
    I have a QGraphicsView and it has many buttons
    I created a QScroller which grabs LeftMouseButton for scrolling
    but buttons can not be clicked

    How can I fix this?

    Thanks

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

      Hi,

      As silly as it may sound: release the mouse grab from your scroller.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        As silly as it may sound: release the mouse grab from your scroller.

        M Offline
        M Offline
        MajidKamali
        wrote on last edited by
        #3

        @SGaist Sorry, I did not understand what you said
        What do you mean by releasing mouse grab?
        Where and how I should do this?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Can you share the code where you setup your QScroller ? We might be talking about two different things.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply
          0
          • SGaistS SGaist

            Can you share the code where you setup your QScroller ? We might be talking about two different things.

            M Offline
            M Offline
            MajidKamali
            wrote on last edited by
            #5

            @SGaist
            In ctor of my window which contains a QGraphicsView:
            QScroller *scroller = QScroller::grabGesture(graphicsView, QScroller::LeftMouseButtonGesture);
            in graphicsView, there are multiple buttons. but buttons are not clickeable when I add above line.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Ok, can you provide a minimal compilable example that shows that behavior ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              M 1 Reply Last reply
              0
              • SGaistS SGaist

                Ok, can you provide a minimal compilable example that shows that behavior ?

                M Offline
                M Offline
                MajidKamali
                wrote on last edited by
                #7

                @SGaist Sorry, I removed my old code, but this is psudo code of what I did:

                QList<QList<QPushButton*>> buttons;
                for(int i = 0; i < 4; i++)
                   for(int j = 0; j < 10; j++)
                   {
                      // set size
                      // set position in scene
                      // add to scene
                   }
                
                // change scene rect, based on buttons positions, with some margin
                
                QScroller *scroller = QScroller::grabGesture(graphicsViewPointer, QScroller::LeftMouseButtonGesture);
                

                By adding last line, I can kinetic scroll the graphicsView with mouse, but I can not click buttons

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  The problem with pseudo code is that I can't reproduce your setup so I can't test in the same condition as you do.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  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