Doc: Generalize timer docs

The snippets do not talk about Qt Widgets specifically.

Change-Id: Icc4f243c93189f08124074e4918d535aa37e6560
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 1f53189c29f80c736877333631338670a06ac439)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Kai Köhne 2021-01-08 11:19:35 +01:00 committed by Qt Cherry-pick Bot
parent 6f74e99d97
commit d127036265

View File

@ -65,14 +65,14 @@
The main API for the timer functionality is QTimer. That class The main API for the timer functionality is QTimer. That class
provides regular timers that emit a signal when the timer fires, and provides regular timers that emit a signal when the timer fires, and
inherits QObject so that it fits well into the ownership structure inherits QObject so that it fits well into the ownership structure
of most GUI programs. The normal way of using it is like this: of most Qt programs. The normal way of using it is like this:
\snippet timers/timers.cpp 0 \snippet timers/timers.cpp 0
\snippet timers/timers.cpp 1 \snippet timers/timers.cpp 1
\snippet timers/timers.cpp 2 \snippet timers/timers.cpp 2
The QTimer object is made into a child of this widget so that, The QTimer object is made into a child of \c this object so that,
when this widget is deleted, the timer is deleted too. when \c this object is deleted, the timer is deleted too.
Next, its \l{QTimer::}{timeout()} signal is connected to the slot Next, its \l{QTimer::}{timeout()} signal is connected to the slot
that will do the work, it is started with a value of 1000 that will do the work, it is started with a value of 1000
milliseconds, indicating that it will time out every second. milliseconds, indicating that it will time out every second.