Obsolete Members for QTimer
Los siguientes miembros de la clase ` QTimer ` están obsoletos. Se mantienen para garantizar el funcionamiento del código fuente antiguo. Recomendamos encarecidamente no utilizarlos en código nuevo.
Miembros públicos estáticos
(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) |
Documentación de las funciones miembro
[static, deprecated in 6.8] void QTimer::singleShot(int msec, const QObject *receiver, const char *member)
Esta función está obsoleta desde la versión 6.8. Recomendamos encarecidamente no utilizarla en código nuevo.
Utiliza las sobrecargas de `chrono`. Esta función estática llama a una ranura tras un intervalo de tiempo determinado.
Es muy práctico utilizar esta función porque evita tener que lidiar con un objeto ` timerEvent ` o crear un objeto ` QTimer ` local.
Ejemplo:
#include <QApplication>
#include <QTimer>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTimer::singleShot(600000, &app, QCoreApplication::quit);
//...
return app.exec();
}Este programa de ejemplo finaliza automáticamente tras 10 minutos (600 000 milisegundos).
El receiver es el objeto receptor y el member es la ranura. El intervalo de tiempo es de msec milisegundos.
A partir de Qt 6.10, establecer un intervalo negativo provocará una advertencia en tiempo de ejecución y el valor se restablecerá a 1 ms. Antes de Qt 6.10, un temporizador de Qt permitía establecer un intervalo negativo, pero se comportaba de formas inesperadas (por ejemplo, detenía el temporizador si estaba en marcha o no lo iniciaba en absoluto).
Nota: Esta función es reentrante.
Véase también ` start()`.
[static, deprecated in 6.8] void QTimer::singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member)
Esta función está obsoleta desde la versión 6.8. Recomendamos encarecidamente no utilizarla en código nuevo.
Utiliza las sobrecargas de `chrono`. Esta función estática llama a una ranura tras un intervalo de tiempo determinado.
Es muy práctico utilizar esta función porque no es necesario preocuparse por un « timerEvent » ni crear un objeto « QTimer » local.
El ` receiver ` es el objeto receptor y el ` member ` es el slot. El intervalo de tiempo es de msec milisegundos. El ` timerType ` afecta a la precisión del temporizador.
A partir de Qt 6.10, establecer un intervalo negativo provocará una advertencia en tiempo de ejecución y el valor se restablecerá a 1 ms. Antes de Qt 6.10, un temporizador de Qt permitía establecer un intervalo negativo, pero se comportaba de forma impredecible (por ejemplo, detenía el temporizador si estaba en marcha o no lo iniciaba en absoluto).
Esta es una función sobrecargada.
Nota: Esta función es reentrante.
Véase también 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.