How to call a function periodically in Qt?

后端 未结 5 1265
耶瑟儿~
耶瑟儿~ 2021-02-14 22:10

Is it possible to call a function periodically in C++ with Qt function ?
And how to stop the timed function after it is set to be called periodically ?

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-14 23:09

    One possibility would be to use a QTimer timeout signal and a QObject slot. Connect the two and start() the timer.

    http://qt-project.org/doc/qt-4.8/qtimer.html#timeout

    To stop the timer, call stop().

提交回复
热议问题