• 10290阅读
  • 2回复

【提问】请问single-shot timer是什么? [复制链接]

上一主题 下一主题
离线kytexzy
 

只看楼主 倒序阅读 楼主  发表于: 2005-11-21
QTimer also provides a static function for single-shot timers.
请问single-shot timer是什么类型的计时器啊?
[ 此贴被fanyu在2005-11-21 08:57重新编辑 ]
try to find forgiveness for yourself and forgive others
离线youngki
只看该作者 1楼 发表于: 2005-11-21
单触发计时器?
知识和财富,只在流通中产生价值
离线tdrhsb
只看该作者 2楼 发表于: 2005-11-22
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是一样的!
快速回复
限100 字节
 
上一个 下一个