void QTimer::singleShot ( int msec, QObject * receiver, const char * member ) [static]
This static function calls a slot after a given time interval.
It is very convenient to use this function because you do not need to bother with a timerEvent or to create a local QTimer object.
Example:
#include <qapplication.h>
#include <qtimer.h>
int main( int argc, char **argv )
{
QApplication a( argc, argv );
QTimer::singleShot( 10*60*1000, &a, SLOT(quit()) );
... // create and show your widgets
return a.exec();
}
This sample program automatically terminates after 10 minutes (i.e. 600000 milliseconds).
//////////////////////////////////////
QTimer::singleShot ()是一个static 函数,你不需要new一个QTimer就可以来定时了!
好像它的机制跟new一个QTimer是一样的!