Migrate QBasicTimer from int to qint64
QBasicTimer::start() now accepts qint64 instead of int. Change-Id: Iba3f394b6c20daf762f1add5a9eed22c8a67c802 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
89a703dcb8
commit
da12a40b8b
@ -287,6 +287,18 @@ QT_WARNING_POP
|
|||||||
|
|
||||||
#include "qbuffer.h" // inline removed API
|
#include "qbuffer.h" // inline removed API
|
||||||
|
|
||||||
|
#include "qbasictimer.h"
|
||||||
|
|
||||||
|
void QBasicTimer::start(int msec, QObject *obj)
|
||||||
|
{
|
||||||
|
start(qint64(msec), obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QBasicTimer::start(int msec, Qt::TimerType timerType, QObject *obj)
|
||||||
|
{
|
||||||
|
start(qint64(msec), timerType, obj);
|
||||||
|
}
|
||||||
|
|
||||||
#include "qenvironmentvariables.h"
|
#include "qenvironmentvariables.h"
|
||||||
|
|
||||||
bool qputenv(const char *varName, const QByteArray &value)
|
bool qputenv(const char *varName, const QByteArray &value)
|
||||||
|
@ -26,8 +26,7 @@ public:
|
|||||||
Qt::TimerType timerType;
|
Qt::TimerType timerType;
|
||||||
|
|
||||||
inline TimerInfo(int id, int i, Qt::TimerType t)
|
inline TimerInfo(int id, int i, Qt::TimerType t)
|
||||||
: timerId(id), interval(i), timerType(t)
|
: timerId(id), interval(i), timerType(t) { }
|
||||||
{ }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit QAbstractEventDispatcher(QObject *parent = nullptr);
|
explicit QAbstractEventDispatcher(QObject *parent = nullptr);
|
||||||
|
@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void QBasicTimer::start(int msec, QObject *object)
|
\fn void QBasicTimer::start(qint64 msec, QObject *object)
|
||||||
|
|
||||||
Starts (or restarts) the timer with a \a msec milliseconds timeout. The
|
Starts (or restarts) the timer with a \a msec milliseconds timeout. The
|
||||||
timer will be a Qt::CoarseTimer. See Qt::TimerType for information on the
|
timer will be a Qt::CoarseTimer. See Qt::TimerType for information on the
|
||||||
@ -110,9 +110,12 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
The given \a object will receive timer events.
|
The given \a object will receive timer events.
|
||||||
|
|
||||||
|
\note In Qt versions prior to 6.5, \a msec was \c{int}, not
|
||||||
|
\c{qint64}.
|
||||||
|
|
||||||
\sa stop(), isActive(), QObject::timerEvent(), Qt::CoarseTimer
|
\sa stop(), isActive(), QObject::timerEvent(), Qt::CoarseTimer
|
||||||
*/
|
*/
|
||||||
void QBasicTimer::start(int msec, QObject *obj)
|
void QBasicTimer::start(qint64 msec, QObject *obj)
|
||||||
{
|
{
|
||||||
start(msec, Qt::CoarseTimer, obj);
|
start(msec, Qt::CoarseTimer, obj);
|
||||||
}
|
}
|
||||||
@ -126,9 +129,12 @@ void QBasicTimer::start(int msec, QObject *obj)
|
|||||||
|
|
||||||
\a obj will receive timer events.
|
\a obj will receive timer events.
|
||||||
|
|
||||||
|
\note In Qt versions prior to 6.5, \a msec was \c{int}, not
|
||||||
|
\c{qint64}.
|
||||||
|
|
||||||
\sa stop(), isActive(), QObject::timerEvent(), Qt::TimerType
|
\sa stop(), isActive(), QObject::timerEvent(), Qt::TimerType
|
||||||
*/
|
*/
|
||||||
void QBasicTimer::start(int msec, Qt::TimerType timerType, QObject *obj)
|
void QBasicTimer::start(qint64 msec, Qt::TimerType timerType, QObject *obj)
|
||||||
{
|
{
|
||||||
QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance();
|
QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance();
|
||||||
if (Q_UNLIKELY(msec < 0)) {
|
if (Q_UNLIKELY(msec < 0)) {
|
||||||
|
@ -31,9 +31,12 @@ public:
|
|||||||
|
|
||||||
bool isActive() const noexcept { return id != 0; }
|
bool isActive() const noexcept { return id != 0; }
|
||||||
int timerId() const noexcept { return id; }
|
int timerId() const noexcept { return id; }
|
||||||
|
#if QT_CORE_REMOVED_SINCE(6, 5)
|
||||||
void start(int msec, QObject *obj);
|
void start(int msec, QObject *obj);
|
||||||
void start(int msec, Qt::TimerType timerType, QObject *obj);
|
void start(int msec, Qt::TimerType timerType, QObject *obj);
|
||||||
|
#endif
|
||||||
|
void start(qint64 msec, QObject *obj);
|
||||||
|
void start(qint64 msec, Qt::TimerType timerType, QObject *obj);
|
||||||
void stop();
|
void stop();
|
||||||
};
|
};
|
||||||
Q_DECLARE_TYPEINFO(QBasicTimer, Q_RELOCATABLE_TYPE);
|
Q_DECLARE_TYPEINFO(QBasicTimer, Q_RELOCATABLE_TYPE);
|
||||||
|
@ -380,18 +380,17 @@ bool QTimerInfoList::timerWait(timespec &tm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns the timer's remaining time in milliseconds with the given timerId, or
|
Returns the timer's remaining time in milliseconds with the given timerId.
|
||||||
null if there is nothing left. If the timer id is not found in the list, the
|
If the timer id is not found in the list, the returned value will be -1.
|
||||||
returned value will be -1. If the timer is overdue, the returned value will be 0.
|
If the timer is overdue, the returned value will be 0.
|
||||||
*/
|
*/
|
||||||
int QTimerInfoList::timerRemainingTime(int timerId)
|
qint64 QTimerInfoList::timerRemainingTime(int timerId)
|
||||||
{
|
{
|
||||||
timespec currentTime = updateCurrentTime();
|
timespec currentTime = updateCurrentTime();
|
||||||
repairTimersIfNeeded();
|
repairTimersIfNeeded();
|
||||||
timespec tm = {0, 0};
|
timespec tm = {0, 0};
|
||||||
|
|
||||||
for (int i = 0; i < count(); ++i) {
|
for (const auto *t : *this) {
|
||||||
QTimerInfo *t = at(i);
|
|
||||||
if (t->id == timerId) {
|
if (t->id == timerId) {
|
||||||
if (currentTime < t->timeout) {
|
if (currentTime < t->timeout) {
|
||||||
// time to wait
|
// time to wait
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
bool timerWait(timespec &);
|
bool timerWait(timespec &);
|
||||||
void timerInsert(QTimerInfo *);
|
void timerInsert(QTimerInfo *);
|
||||||
|
|
||||||
int timerRemainingTime(int timerId);
|
qint64 timerRemainingTime(int timerId);
|
||||||
|
|
||||||
void registerTimer(int timerId, qint64 interval, Qt::TimerType timerType, QObject *object);
|
void registerTimer(int timerId, qint64 interval, Qt::TimerType timerType, QObject *object);
|
||||||
bool unregisterTimer(int timerId);
|
bool unregisterTimer(int timerId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user