diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-07-02 13:23:09 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-07-02 15:32:03 +0200 |
commit | 64c1fbe96c68b1286a70242ff4922be140128cb2 (patch) | |
tree | c95a2d68fc50319f04e6cbae4c471c524c66ba5f /src/quick/util/qquickstate.cpp | |
parent | dfd12d4079b339a140d4697c7ca92c5ea4233315 (diff) |
use boolean for when property
QQuickState used to store "when" as a QQmlBinding to reduce state
oscillation.
It is unclear whether this is still an issue, but it breaks if a user
sets "when" to a primitive value like "true" or "1".
Fixes: QTBUG-76838
Change-Id: If400e5b1283687838ed252be2dfa52067f44564e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/quick/util/qquickstate.cpp')
-rw-r--r-- | src/quick/util/qquickstate.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/quick/util/qquickstate.cpp b/src/quick/util/qquickstate.cpp index 3ca6440784..473539ab2c 100644 --- a/src/quick/util/qquickstate.cpp +++ b/src/quick/util/qquickstate.cpp @@ -192,7 +192,7 @@ bool QQuickState::isNamed() const bool QQuickState::isWhenKnown() const { Q_D(const QQuickState); - return d->when != nullptr; + return d->whenKnown; } /*! @@ -219,15 +219,16 @@ bool QQuickState::isWhenKnown() const } \endqml */ -QQmlBinding *QQuickState::when() const +bool QQuickState::when() const { Q_D(const QQuickState); - return d->when.data(); + return d->when; } -void QQuickState::setWhen(QQmlBinding *when) +void QQuickState::setWhen(bool when) { Q_D(QQuickState); + d->whenKnown = true; d->when = when; if (d->group) d->group->updateAutoState(); |