Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Single Click Event and Double Click Event

Single Click Event and Double Click Event

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    samdol
    wrote on last edited by
    #1

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

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      3

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved