Make from_msecs a QTimer class-static again

It will need to be called from removed_api.cpp once we widen
QTimer::singleShot() from ms to ns.

Don't use the QAbstractEventDispatcher::Duration typedef in qtimer.h
to avoid including the resp. header. Keep the typedef as the return
value on the definition of from_msecs(), though, as a static assertion
that they're identical.

Task-number: QTBUG-128426
Change-Id: Ib59895f4441e92813fe39778bb3836b039fdfbf0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 65a249715941bf6b6ecc980d3f865f367f66522d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-08-28 15:22:20 +02:00 committed by Qt Cherry-pick Bot
parent 79dec148a9
commit 92597843d6
2 changed files with 4 additions and 1 deletions

View File

@ -290,7 +290,8 @@ void QTimer::timerEvent(QTimerEvent *e)
}
}
static QAbstractEventDispatcher::Duration from_msecs(std::chrono::milliseconds ms)
QAbstractEventDispatcher::Duration // statically asserts that Duration is nanoseconds
QTimer::from_msecs(std::chrono::milliseconds ms)
{
using Duration = QAbstractEventDispatcher::Duration;

View File

@ -144,6 +144,8 @@ private:
Q_DECLARE_PRIVATE(QTimer)
friend class QChronoTimer;
static std::chrono::nanoseconds from_msecs(std::chrono::milliseconds);
inline int startTimer(int){ return -1;}
inline void killTimer(int){}