Single Click Event and Double Click Event



  • Hi

    I created a slot function single() for mousePressEvent and a slot function double() for mouseDbClickEvent. So if I double click the mouse button, single() runs and after then double() runs. This is what happen when single() contains light job. But if single() contains heavy duty, I don't see double() runs. It seems single() eats up the mouseDbClickEvent signal. What should I do to make double() runs when I double click mouse button where single() contains heavy job?
    I am not interested in distinguish single click and double click by timer, becau
    se it delays the excution of single().


  • Qt Champions 2016

    Hi
    Qt is event based.
    In main.cpp you see the app.exec() call.
    This is the event loop.
    When a signal is emitted, its being delivered via this loop.

    But if you stay in side a slot, for a long time. You will block this loop
    and NO other signals will be delivered.

    So do not make heavy stuff in slots.

    You can use threads for it.
    http://doc.qt.io/qt-5/thread-basics.html


Log in to reply
 

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