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分(600,000ミリ秒)後に自動的に終了します。

receiver が受信オブジェクトであり、member がスロットです。時間間隔はmsec ミリ秒です。

Qt 6.10 以降、負のインターバルを設定すると、実行時の警告が表示され、値は 1ms にリセットされます。 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()も参照してください 。

© 2026 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.