Unsolved QScroller prevent button click
-
Hi
I have a QGraphicsView and it has many buttons
I created a QScroller which grabs LeftMouseButton for scrolling
but buttons can not be clickedHow can I fix this?
Thanks
-
Hi,
As silly as it may sound: release the mouse grab from your scroller.
-
@SGaist Sorry, I did not understand what you said
What do you mean by releasing mouse grab?
Where and how I should do this? -
Can you share the code where you setup your QScroller ? We might be talking about two different things.
-
@SGaist
In ctor of my window which contains aQGraphicsView
:
QScroller *scroller = QScroller::grabGesture(graphicsView, QScroller::LeftMouseButtonGesture);
in graphicsView, there are multiple buttons. but buttons are not clickeable when I add above line. -
Ok, can you provide a minimal compilable example that shows that behavior ?
-
@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
-
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.