Doc: Clarify setInterval() and start() for active timer

Despite using different code paths, both stop and then
re-start an already active timer, which invalidates
the id().

While at it, port the occurrences of timerId() to the
modern function id(), which exists in both QTimer and
QChronoTimer

Change-Id: I5db099b198b1c11e1cdbd0fbb30ecece5d0135c8
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit ea0f8cee55e56d0f03ea9a185faee328b5cfa7bf)
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
bb10
Andre Hartmann 2024-07-31 17:31:16 +02:00 committed by Ahmad Samir
parent 5f46669178
commit 68326ad432
2 changed files with 9 additions and 5 deletions

View File

@ -183,7 +183,8 @@ Qt::TimerId QChronoTimer::id() const
//! [stop-restart-timer]
If the timer is already running, it will be
\l{QChronoTimer::stop()}{stopped} and restarted.
\l{QChronoTimer::stop()}{stopped} and restarted. This will also change its
id().
//! [stop-restart-timer]
If \l singleShot is true, the timer will be activated only once.
@ -279,8 +280,9 @@ QBindable<bool> QChronoTimer::bindableSingleShot()
A QChronoTimer with a timeout of \c 0ns will time out as soon as all
the events in the window system's event queue have been processed.
Setting the interval of an active timer changes the interval and acquires
a new id(). If the timer is not active, only the interval is changed.
Setting the interval of an active timer will change the interval,
stop() and then start() the timer, and acquire a new id().
If the timer is not active, only the interval is changed.
\sa singleShot
*/

View File

@ -204,7 +204,7 @@ Qt::TimerId QTimer::id() const
//! [stop-restart-timer]
If the timer is already running, it will be
\l{QTimer::stop()}{stopped} and restarted.
\l{QTimer::stop()}{stopped} and restarted. This will also change its id().
//! [stop-restart-timer]
//! [singleshot-activation]
@ -591,7 +591,9 @@ QBindable<bool> QTimer::bindableSingleShot()
interval of 0 will time out as soon as all the events in the window
system's event queue have been processed.
Setting the interval of an active timer changes its timerId().
Setting the interval of an active timer will change the interval,
stop() and then start() the timer, and acquire a new id().
If the timer is not active, only the interval is changed.
\sa singleShot
*/