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から非推奨となった。新しいコードでは使用しないことを強くお勧めします。
chronoオーバーロードを使用してください。この静的関数は、与えられた時間間隔の後にスロットを呼び出します。
この関数を使うと、わざわざ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分(60万ミリ秒)後に自動的に終了します。
receiver が受信オブジェクトで、member がスロットです。時間間隔はmsec ミリ秒です。
Qt 6.10以降、負の時間間隔を設定すると実行時に警告が表示され、値は1ミリ秒にリセットされます。Qt 6.10以前のQt Timerでは、負の間隔を設定しても、驚くような動作をすることがありました(例えば、タイマーが実行中であれば停止したり、全く起動しなかったり)。
注意:この関数はリエントラントです。
start()も参照してください 。
[static, deprecated in 6.8]
void QTimer::singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member)
この関数は6.8から非推奨となった。新しいコードでは使用しないことを強くお勧めします。
chronoオーバーロードを使用してください。この静的関数は、与えられた時間間隔の後にスロットを呼び出します。
この関数を使うと、わざわざtimerEvent を使ったり、ローカルのQTimer オブジェクトを作ったりする必要がないので、とても便利です。
receiver が受信オブジェクトで、member がスロットです。時間間隔はmsec ミリ秒です。timerType はタイマーの精度に影響します。
Qt 6.10以降、負のインターバルを設定すると実行時に警告が表示され、値は1msにリセットされます。Qt 6.10以前のQt Timerでは、負のインターバルを設定しても、驚くような動作をすることがありました(例えば、実行中のタイマーを停止したり、全く起動しなかったり)。
これはオーバーロードされた関数です。
注意:この関数はリエントラントです。
start()も参照してください 。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.