Solved grapGesture - QScrollArea scroll with 1 Finger touch
-
Hello,
I found this wayQScroller::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 ???????????? -
@Andy314 said:
QScroller::grabGesture
hii
what you u also call
QScroller::grabGesture
for the second
one-Finger-ScrollArea ? -
Yes, of course !
-
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 ?
-
well
when you open this dialog, do you call exec() ?
That will start a local event loop and it might be the reason. -
Yes, I start a modal dialog with exec !
-
@Andy314
ok, that might do strange stuff as it stays in there.
try calling show() instead to testnote, show() dont block so if u have code
dia.exec()
code that do something with dialog stuff after OKswitching to show() wont work.
-
@mrjj
Indeed with show it works.Any ideas how perform it with exec ?
-
@Andy314
Only as you self discovered to use a timer to
start it via other signal. -
@mrjj
Thank you for you help, here is my short solution:QMetaObject::invokeMethod(this, "functionToCall", Qt::QueuedConnection);
-