Qt编程技巧 延时

延时可以使用这个函数

1
void QTimer::singleShot ( int msec, QObject * receiver, const char * member )   [static]

Example:

1
2
3
4
5
6
7
8
9
#include <QApplication>
#include <QTimer>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTimer::singleShot(600000, &app, SLOT(quit()));
...
return app.exec();
}