summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qtimer.cpp
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2024-02-16 15:34:18 +0200
committerAhmad Samir <a.samirh78@gmail.com>2024-02-17 22:34:55 +0200
commitadc0920c48d812fb1b3e2b7bfc76217a7126a41e (patch)
tree5cd5a73246de9bf6d633405a2933b945bedbf3c8 /src/corelib/kernel/qtimer.cpp
parent1461fbb5d183e8894ad1a097c147dce21656bd01 (diff)
QTimer: make both defaultTypeFor() methods constexpr and noexcept
Also de-duplicate the code by using defaultTypeFor() in singleShot(), this way the comment and the calculation are done in one central place. Pick-to: 6.7 Change-Id: Ib822cae0e9228e546b664fbac728a60d65c4bbc3 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qtimer.cpp')
-rw-r--r--src/corelib/kernel/qtimer.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index 04e32d9ec72..f93293f2832 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -329,10 +329,7 @@ void QTimer::singleShotImpl(int msec, Qt::TimerType timerType,
void QTimer::singleShot(int msec, const QObject *receiver, const char *member)
{
- // coarse timers are worst in their first firing
- // so we prefer a high precision timer for something that happens only once
- // unless the timeout is too big, in which case we go for coarse anyway
- singleShot(msec, msec >= 2000 ? Qt::CoarseTimer : Qt::PreciseTimer, receiver, member);
+ singleShot(msec, defaultTypeFor(msec), receiver, member);
}
/*! \overload