Qt World Summit: Register Today!

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().

  • Lifetime Qt Champion

    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.

Log in to reply