[SOLVED] QTimer class probably contains a bug



  • Hi!

    I have a problem with QTimer. See code:
    @ // this timer is connected to timesUp slot
    myTimer->start(18);
    }

    void MainWindow::timesUp()
    {
    std::cout << QTime::currentTime().msec() << std::endl;
    // ...
    /* standard output looks like:
    278
    294
    313
    331
    349
    367
    384

    That is right!! */
    @

    BUT:
    @ // this timer is connected to timesUp slot
    myTimer->start(20);
    }

    /* standard output looks like:
    224
    256
    291
    318
    351
    382
    414 */@

    Why difference is 30ms instead of 20ms?!

    Thanks for reply


  • Moderators

    this has been discussed many, many times already... just use the search

    Long story short:



  • Thank you.
    I set timer type to Qt::PreciseTimer and now timer is working great. :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.