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 is slow on mac if application is running in background

QTimer is slow on mac if application is running in background

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.1k 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.
  • J Offline
    J Offline
    JackLaw
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0
      • J Offline
        J Offline
        JackLaw
        wrote on last edited by
        #3

        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
        0

        • Login

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