Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
timers.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QTimer>
5
6class Foo : public QObject
7{
8public:
9 Foo();
10};
11
13{
15 QTimer *timer = new QTimer(this);
17 connect(timer, &QTimer::timeout, this, &Foo::updateCaption);
19 timer->start(1000);
21
23 QTimer::singleShot(200, this, &Foo::updateCaption);
25
26 {
27 // ZERO-CASE
29 QTimer *timer = new QTimer(this);
31 connect(timer, &QTimer::timeout, this, &Foo::processOneThing);
33 timer->start();
35 }
36}
37
38int main()
39{
40
41}
Foo()
Definition timers.cpp:12
\inmodule QtCore
Definition qobject.h:90
\inmodule QtCore
Definition qtimer.h:20
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
Definition qtimer.cpp:208
bool singleShot
whether the timer is a single-shot timer
Definition qtimer.h:22
void timeout(QPrivateSignal)
This signal is emitted when the timer times out.
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
QTimer * timer
[3]
int main()
Definition timers.cpp:38