From 3ca95a92835b92c9aeb6abbb7a26de73e3170ece Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Wed, 24 Apr 2013 14:01:20 +0200 Subject: [PATCH] Make pathElements designer ready The append and clear case was not handled before but the designer is changing the pathElements. Change-Id: I373e26a7c597774c3e985a8c26a564700e9ee9de Reviewed-by: Alan Alpert --- src/quick/util/qquickpath.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index 0b0c330..fc33f8f 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -213,8 +213,24 @@ QQuickPathElement *QQuickPath::pathElements_at(QQmlListProperty *property, QQuickPathElement *pathElement) { QQuickPathPrivate *d = privatePath(property->object); + QQuickPath *path = static_cast(property->object); d->_pathElements.append(pathElement); + + if (d->componentComplete) { + QQuickCurve *curve = qobject_cast(pathElement); + if (curve) + d->_pathCurves.append(curve); + else { + QQuickPathAttribute *attribute = qobject_cast(pathElement); + if (attribute && !d->_attributes.contains(attribute->name())) + d->_attributes.append(attribute->name()); + } + + path->processPath(); + + connect(pathElement, SIGNAL(changed()), path, SLOT(processPath())); + } } int QQuickPath::pathElements_count(QQmlListProperty *property) @@ -227,8 +243,12 @@ int QQuickPath::pathElements_count(QQmlListProperty *property void QQuickPath::pathElements_clear(QQmlListProperty *property) { QQuickPathPrivate *d = privatePath(property->object); + QQuickPath *path = static_cast(property->object); + path->disconnectPathElements(); d->_pathElements.clear(); + d->_pathCurves.clear(); + d->_pointCache.clear(); } void QQuickPath::interpolate(int idx, const QString &name, qreal value) -- 2.7.4