Obsolete Members for QTimer

The following members of class QTimer are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.

Static Public Members

(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)

Member Function Documentation

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

This function is deprecated since 6.8. We strongly advise against using it in new code.

Use the chrono overloads. 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, QCoreApplication::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 start().

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

This function is deprecated since 6.8. We strongly advise against using it in new code.

This is an overloaded function.

Use the chrono overloads. 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.

The receiver is the receiving object and the member is the slot. The time interval is msec milliseconds. The timerType affects the accuracy of the timer.

Note: This function is reentrant.

See also start().

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