diff options
author | Oleg Yadrov <oleg.yadrov@qt.io> | 2016-12-19 12:08:20 -0800 |
---|---|---|
committer | Oleg Yadrov <oleg.yadrov@qt.io> | 2017-01-20 00:13:24 +0000 |
commit | 7ee15ecdd960cde6d0202e9675f7f6bd31bbb927 (patch) | |
tree | 4d543697b552eada54971b7d0684e0495507e308 /src/quick/util | |
parent | edffdcf9b45641708fb242449b77e8e53ee05d87 (diff) |
PathAnimation: fix bug when PathSvg or PathLine is the last item in Path
Both QQuickPathLine and QQuickPathSvg inherit QQuickCurve class which
has “x” and “y” properties that return qreal type, but internally they
are stored as QQmlNullableValue<qreal>. At the same time, if any of them
is not specified explicitly, its getter returns 0.
QQuickPath processes QQuickPath%Type% objects and produces a
QPainterPath which later used by QQuickPathAnimation.
QQuickPathAnimation only created a QAbstractAnimationJob if
QQuickPath::hasEnd returned true, and hasEnd returned true only if both
“x” and “y” were specified explicitly.
All that in conjunction led to the situation when if you had either
- a PathLine with unspecified “x” or “y”; or
- a PathSvg
which was the last (or the only) path element in your Path,
PathAnimation would not start.
This patch removes hasEnd check, it should be safe to do because
QPainterPath is always valid anyway due to the fact QQuickCurve::x()
and QQuickCurve::y() return 0 if they have not been not explicitly set.
Task-number: QTBUG-57666
Change-Id: Id320aaeb5aff0964d6493b7b80d5d9a7d36acce8
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
Diffstat (limited to 'src/quick/util')
-rw-r--r-- | src/quick/util/qquickpath.cpp | 14 | ||||
-rw-r--r-- | src/quick/util/qquickpath_p.h | 1 |
2 files changed, 0 insertions, 15 deletions
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index 25a4433a9b..e31aed7b6d 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -149,20 +149,6 @@ bool QQuickPath::isClosed() const return d->closed; } -bool QQuickPath::hasEnd() const -{ - Q_D(const QQuickPath); - for (int i = d->_pathElements.count() - 1; i > -1; --i) { - if (QQuickCurve *curve = qobject_cast<QQuickCurve *>(d->_pathElements.at(i))) { - if ((!curve->hasX() && !curve->hasRelativeX()) || (!curve->hasY() && !curve->hasRelativeY())) - return false; - else - return true; - } - } - return hasStartX() && hasStartY(); -} - /*! \qmlproperty list<PathElement> QtQuick::Path::pathElements This property holds the objects composing the path. diff --git a/src/quick/util/qquickpath_p.h b/src/quick/util/qquickpath_p.h index 06ad389b49..c0a96cad4f 100644 --- a/src/quick/util/qquickpath_p.h +++ b/src/quick/util/qquickpath_p.h @@ -390,7 +390,6 @@ public: bool hasStartY() const; bool isClosed() const; - bool hasEnd() const; QPainterPath path() const; QStringList attributes() const; |