Obsolete Members for QTimer

以下成員源於類 QTimer 被棄用。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。

靜態公共成員

(deprecated in 6.8) void singleShot (int msec , const QObject * receiver , const char * member )
(deprecated in 6.8) void singleShot (int msec , Qt::TimerType timerType , const QObject * receiver , const char * member )

成員函數文檔編製

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

此函數從 6.8 起棄用。強烈建議在新代碼中不要使用它。

Use the chrono overloads. This static function calls a slot after a given time interval.

使用此函數非常方便,因為不需要麻煩采用 timerEvent 或創建本地 QTimer 對象。

範例:

#include <QApplication>
#include <QTimer>
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QTimer::singleShot(600000, &app, QCoreApplication::quit);
    ...
    return app.exec();
}
					

此範例程序在 10 分鍾 (600,000 毫秒) 後自動終止。

The receiver 是接收對象而 member 是槽。時間間隔為 msec 毫秒。

注意: 此函數是 可重入 .

另請參閱 start ().

[static, deprecated in 6.8] void QTimer:: singleShot ( int msec , Qt::TimerType timerType , const QObject * receiver , const char * member )

此函數從 6.8 起棄用。強烈建議在新代碼中不要使用它。

這是重載函數。

Use the chrono overloads. This static function calls a slot after a given time interval.

使用此函數非常方便,因為不需要麻煩采用 timerEvent 或創建本地 QTimer 對象。

The receiver 是接收對象而 member 是槽。時間間隔為 msec 毫秒。 timerType 影響計時器精度。

注意: 此函數是 可重入 .

另請參閱 start ().