summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-02-15 13:39:04 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2021-02-16 09:42:46 +0100
commit4e3a5f266ede947115235285f6f0cb55636a47f0 (patch)
treef0d521ba91467ee3f97d5fb390c199eaadd21377
parentcc4bcf94e0f33dc72b5cfeb01cd0e6f647925c88 (diff)
Do not make QTimer::interval bindable
Issues were found and fixed only in 6.2. Let's play it safe and do not make interval bindable in 6.1. Change-Id: I4465d3991d0c303037de7421d5a670f009ac2bf9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
-rw-r--r--src/corelib/kernel/qtimer.cpp16
-rw-r--r--src/corelib/kernel/qtimer.h3
-rw-r--r--tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp21
3 files changed, 4 insertions, 36 deletions
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index 8148ced222..c9507f36ad 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -54,11 +54,10 @@ class QTimerPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QTimer)
public:
- void setInterval(int msec) { q_func()->setInterval(msec); }
bool isActiveActualCalculation() const { return id >= 0; }
int id = INV_TIMER;
- Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QTimerPrivate, int, inter, &QTimerPrivate::setInterval, 0)
+ int inter = 0;
Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(QTimerPrivate, bool, single, false)
bool nulltimer = false;
Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(QTimerPrivate, Qt::TimerType, type, Qt::CoarseTimer)
@@ -257,9 +256,8 @@ void QTimer::start()
void QTimer::start(int msec)
{
Q_D(QTimer);
- d->inter.setValueBypassingBindings(msec);
+ d->inter = msec;
start();
- d->inter.markDirty();
}
@@ -753,14 +751,11 @@ QBindable<bool> QTimer::bindableSingleShot()
void QTimer::setInterval(int msec)
{
Q_D(QTimer);
- d->inter.setValueBypassingBindings(msec);
+ d->inter = msec;
if (d->id != INV_TIMER) { // create new timer
QObject::killTimer(d->id); // restart timer
d->id = QObject::startTimer(msec, d->type);
- // No need to call markDirty() for d->isActiveData here,
- // as timer state actually does not change
}
- d->inter.markDirty();
}
int QTimer::interval() const
@@ -768,11 +763,6 @@ int QTimer::interval() const
return d_func()->inter;
}
-QBindable<int> QTimer::bindableInterval()
-{
- return QBindable<int>(&d_func()->inter);
-}
-
/*!
\property QTimer::remainingTime
\since 5.0
diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h
index 2b262f6311..7f3fc4fcec 100644
--- a/src/corelib/kernel/qtimer.h
+++ b/src/corelib/kernel/qtimer.h
@@ -58,7 +58,7 @@ class Q_CORE_EXPORT QTimer : public QObject
{
Q_OBJECT
Q_PROPERTY(bool singleShot READ isSingleShot WRITE setSingleShot BINDABLE bindableSingleShot)
- Q_PROPERTY(int interval READ interval WRITE setInterval BINDABLE bindableInterval)
+ Q_PROPERTY(int interval READ interval WRITE setInterval)
Q_PROPERTY(int remainingTime READ remainingTime)
Q_PROPERTY(Qt::TimerType timerType READ timerType WRITE setTimerType BINDABLE bindableTimerType)
Q_PROPERTY(bool active READ isActive STORED false BINDABLE bindableActive)
@@ -72,7 +72,6 @@ public:
void setInterval(int msec);
int interval() const;
- QBindable<int> bindableInterval();
int remainingTime() const;
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
index cd0a0d03d9..54ae804274 100644
--- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
+++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
@@ -1100,16 +1100,6 @@ void tst_QTimer::bindToTimer()
timer.setSingleShot(false);
QVERIFY(!singleShot);
- // interval property
- QProperty<int> interval;
- interval.setBinding([&](){ return timer.interval(); });
- QCOMPARE(timer.interval(), interval);
-
- timer.setInterval(10);
- QCOMPARE(interval, 10);
- timer.setInterval(100);
- QCOMPARE(interval, 100);
-
// timerType property
QProperty<Qt::TimerType> timerType;
timerType.setBinding(timer.bindableTimerType().makeBinding());
@@ -1148,17 +1138,6 @@ void tst_QTimer::bindTimer()
singleShot = false;
QVERIFY(!timer.isSingleShot());
- // interval property
- QCOMPARE(timer.interval(), 0);
-
- QProperty<int> interval;
- timer.bindableInterval().setBinding(Qt::makePropertyBinding(interval));
-
- interval = 10;
- QCOMPARE(timer.interval(), 10);
- interval = 100;
- QCOMPARE(timer.interval(), 100);
-
// timerType property
QCOMPARE(timer.timerType(), Qt::CoarseTimer);