Posted on 2011-05-01 13:21
RTY 阅读(2256)
评论(0) 编辑 收藏 引用 所属分类:
Qt 、
Python
1、示例代码
1 QtCore.QTimer.singleShot(self.delaySpinBox.value() * 1000,
2 self.shootScreen)
2、关于QTimer.singleShot 的用法
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 create a local QTimer object.
Example:
#include <QApplication>
#include <QTimer>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTimer::singleShot(600000, &app, SLOT(quit()));
...
return app.exec();
}
This sample program automatically terminates after 10 minutes (600,000 milliseconds).
The receiver is the receiving object and the member is the slot. The time interval is msec milliseconds.
Note: This function is reentrant.
See also setSingleShot() and start().