#includeint main(int argc, char *argv[]) { // ... QApplication initialization ... QTimer timer; timer.setInterval(1000); timer.start(); bool is_active = timer.isActive(); qDebug() << "Is timer currently active?" << is_active; // ... QApplication event loop ... }
#includeBoth examples use the Qt Core module.int main(int argc, char *argv[]) { // ... QApplication initialization ... QTimer timer; timer.setInterval(5000); timer.setSingleShot(true); timer.start(); QThread::sleep(10); bool is_active = timer.isActive(); qDebug() << "Is timer still active?" << is_active; // ... QApplication event loop ... }