Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QTimer is slow on mac if application is running in background

    General and Desktop
    2
    3
    1851
    Loading More Posts
    • 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.
    • J
      JackLaw last edited by

      Hi,

      I created a simple timer application.
      @
      timer = new QTimer(this);
      timer->setTimerType(Qt::PreciseTimer);
      @

      It runs accurately on Windows and Mac according to my tests.

      However, if I put the application in background (such as placing another application window on top of it), the timer is slower by about 30% or more.

      This doesn't happen on Windows whether the application is on top or not.

      Any ideas to fix it?
      Thanks!

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        You should provide a minimal compilable example that shows the behavior so it can be tested.

        Also, which version of Qt and OS X are you using ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • J
          JackLaw last edited by

          Hi SGaist,

          I have read your post on "another thread":http://qt-project.org/forums/viewthread/37750, in which you suggested

          @
          defaults write <app domain name> NSAppSleepDisabled -bool YES
          @

          However, I am wondering if there is a way to build this configuration into a Qt app, so that users don't have to do this themselves?

          About the source code, I have put it on "github":https://github.com/codelol/QtTimer. I have also upload binaries in "release". Please try it :)

          Versions: Qt 5.3, Mac OS 10.9.4 64bit.

          Thanks!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post