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. QTimer question
Qt 6.11 is out! See what's new in the release blog

QTimer question

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 1.5k Views 2 Watching
  • 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.
  • D Offline
    D Offline
    DRoscoe
    wrote on last edited by
    #1

    If I call:

    some_timer.blockSignals(true);
    
    [do so processing]
    
    some_timer.start();
    some_timer.blockSignals(false);
    

    Will that work? I ran into a situation where the [do some processing] part took more than the defined interval for the timer, causing a timeout event to be queued up before I could restart the timer. I just want to make sure that the call to start() will effectively restart the timer even if I am blocking signals.

    Thanks!

    kshegunovK 1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! I don't see a problem here, but I don't understand why you don't just stop the timer before [some processing] and restart it afterwards.

      D 1 Reply Last reply
      6
      • D DRoscoe

        If I call:

        some_timer.blockSignals(true);
        
        [do so processing]
        
        some_timer.start();
        some_timer.blockSignals(false);
        

        Will that work? I ran into a situation where the [do some processing] part took more than the defined interval for the timer, causing a timeout event to be queued up before I could restart the timer. I just want to make sure that the call to start() will effectively restart the timer even if I am blocking signals.

        Thanks!

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by kshegunov
        #3

        Hi,
        You should get a single timer event (assuming the timer expires at least once).

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        2
        • ? A Former User

          Hi! I don't see a problem here, but I don't understand why you don't just stop the timer before [some processing] and restart it afterwards.

          D Offline
          D Offline
          DRoscoe
          wrote on last edited by
          #4

          @Wieland actually, that's exactly what I ended up doing. Not sure why I didn't think of that up front.

          1 Reply Last reply
          1

          • Login

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