diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/corelib/kernel/qbasictimer.cpp | 4 | ||||
| -rw-r--r-- | src/corelib/kernel/qchronotimer.cpp | 2 | ||||
| -rw-r--r-- | src/corelib/kernel/qobject.cpp | 11 | ||||
| -rw-r--r-- | src/corelib/kernel/qtimer.cpp | 4 |
4 files changed, 11 insertions, 10 deletions
diff --git a/src/corelib/kernel/qbasictimer.cpp b/src/corelib/kernel/qbasictimer.cpp index e7626f74263..17711a355e6 100644 --- a/src/corelib/kernel/qbasictimer.cpp +++ b/src/corelib/kernel/qbasictimer.cpp @@ -165,7 +165,7 @@ void QBasicTimer::start(std::chrono::milliseconds duration, Qt::TimerType timerT } stop(); if (obj) - id = eventDispatcher->registerTimer(duration.count(), timerType, obj); + id = int(eventDispatcher->registerTimer(duration, timerType, obj)); } /*! @@ -177,7 +177,7 @@ void QBasicTimer::stop() { if (id) { QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance(); - if (eventDispatcher && !eventDispatcher->unregisterTimer(id)) { + if (eventDispatcher && !eventDispatcher->unregisterTimer(Qt::TimerId(id))) { qWarning("QBasicTimer::stop: Failed. Possibly trying to stop from a different thread"); return; } diff --git a/src/corelib/kernel/qchronotimer.cpp b/src/corelib/kernel/qchronotimer.cpp index 4da75382782..a517c4446b4 100644 --- a/src/corelib/kernel/qchronotimer.cpp +++ b/src/corelib/kernel/qchronotimer.cpp @@ -330,7 +330,7 @@ QBindable<std::chrono::nanoseconds> QChronoTimer::bindableInterval() std::chrono::nanoseconds QChronoTimer::remainingTime() const { if (isActive()) - return 1ms * QAbstractEventDispatcher::instance()->remainingTime(qToUnderlying(d_func()->id)); + return QAbstractEventDispatcher::instance()->remainingTime(d_func()->id); return std::chrono::nanoseconds::min(); } diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 162420532ff..dba3529b947 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1453,7 +1453,7 @@ bool QObject::event(QEvent *e) QThreadData *threadData = d->threadData.loadRelaxed(); QAbstractEventDispatcher *eventDispatcher = threadData->eventDispatcher.loadRelaxed(); if (eventDispatcher) { - QList<QAbstractEventDispatcher::TimerInfo> timers = eventDispatcher->registeredTimers(this); + QList<QAbstractEventDispatcher::TimerInfoV2> timers = eventDispatcher->timersForObject(this); if (!timers.isEmpty()) { const bool res = eventDispatcher->unregisterTimers(this); // do not to release our timer ids back to the pool (since the timer ids are moving to a new thread). @@ -1920,11 +1920,10 @@ int QObject::startTimer(std::chrono::nanoseconds interval, Qt::TimerType timerTy } auto dispatcher = thisThreadData->eventDispatcher.loadRelaxed(); - const auto msecs = std::chrono::ceil<std::chrono::milliseconds>(interval); - int timerId = dispatcher->registerTimer(msecs.count(), timerType, this); + Qt::TimerId timerId = dispatcher->registerTimer(interval, timerType, this); d->ensureExtraData(); - d->extraData->runningTimers.append(Qt::TimerId{timerId}); - return timerId; + d->extraData->runningTimers.append(timerId); + return int(timerId); } /*! @@ -1966,7 +1965,7 @@ void QObject::killTimer(Qt::TimerId id) auto thisThreadData = d->threadData.loadRelaxed(); if (thisThreadData->hasEventDispatcher()) - thisThreadData->eventDispatcher.loadRelaxed()->unregisterTimer(qToUnderlying(id)); + thisThreadData->eventDispatcher.loadRelaxed()->unregisterTimer(id); d->extraData->runningTimers.remove(at); QAbstractEventDispatcherPrivate::releaseTimerId(id); diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 3291c7d24bf..cc46c1433b5 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -632,7 +632,9 @@ int QTimer::remainingTime() const { Q_D(const QTimer); if (d->isActive()) { - return QAbstractEventDispatcher::instance()->remainingTime(qToUnderlying(d->id)); + using namespace std::chrono; + auto remaining = QAbstractEventDispatcher::instance()->remainingTime(d->id); + return ceil<milliseconds>(remaining).count(); } return -1; |
