Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QTimer from a non QThread



  • Can QTimer be called from a normal C++ main and not a QThread or a main using a QCoreApplication?


  • Moderators

    @slilly

    Can QTimer be called from

    What does this mean?
    A timer object will generate the timeout() signal at (almost) regular intervals, you can subscribe to that and do whatever you want. What do you want to call from a QTimer instance? If you mean to use QTimer without an event loop (i.e. without QCoreApplication), well then, no you can't do that.


  • Moderators

    @slilly said:

    Can QTimer be called from a normal C++ main and not a QThread or a main using a QCoreApplication?

    No. If you want to use QTimer, then you need QCoreApplication::exec() or QThread::exec().


Log in to reply