grapGesture - QScrollArea scroll with 1 Finger touch



  • 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 ????????????


  • Qt Champions 2016

    @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 ?


  • Qt Champions 2016

    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 !


  • Qt Champions 2016

    @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.



  • @mrjj
    Indeed with show it works.

    Any ideas how perform it with exec ?


  • Qt Champions 2016

    @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);
    

  • Qt Champions 2016

    @Andy314 said:

    QueuedConnection

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.