diff options
author | Marco Bubke <marco.bubke@digia.com> | 2013-04-24 13:26:51 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-24 21:36:01 +0200 |
commit | e65835789c8022d7105f05679a64fd468c5b44d2 (patch) | |
tree | d4a893a1c0fa35c3dcfa907e36a9190fd533df83 /src/quick/util/qquickpath.cpp | |
parent | 20d33b96acf95fc1e162c4e8ed00d4b0b20806d9 (diff) |
Refactor QQuickPath componentComplete
It is a prequel for the refactoring of the pathElements property.
Change-Id: I56cc4b9b419fecf96e331a6cab58b33157742e70
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/quick/util/qquickpath.cpp')
-rw-r--r-- | src/quick/util/qquickpath.cpp | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index 3aea724983..49b9e4c4e3 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -373,27 +373,49 @@ void QQuickPath::classBegin() d->componentComplete = false; } -void QQuickPath::componentComplete() +void QQuickPath::disconnectPathElements() +{ + Q_D(QQuickPath); + + foreach (QQuickPathElement *pathElement, d->_pathElements) + disconnect(pathElement, SIGNAL(changed()), this, SLOT(processPath())); +} + +void QQuickPath::connectPathElements() +{ + Q_D(QQuickPath); + + foreach (QQuickPathElement *pathElement, d->_pathElements) + connect(pathElement, SIGNAL(changed()), this, SLOT(processPath())); +} + +void QQuickPath::gatherAttributes() { Q_D(QQuickPath); - QSet<QString> attrs; - d->componentComplete = true; + + QSet<QString> attributes; // First gather up all the attributes foreach (QQuickPathElement *pathElement, d->_pathElements) { - if (QQuickCurve *curve = - qobject_cast<QQuickCurve *>(pathElement)) + if (QQuickCurve *curve = qobject_cast<QQuickCurve *>(pathElement)) d->_pathCurves.append(curve); - else if (QQuickPathAttribute *attribute = - qobject_cast<QQuickPathAttribute *>(pathElement)) - attrs.insert(attribute->name()); + else if (QQuickPathAttribute *attribute = qobject_cast<QQuickPathAttribute *>(pathElement)) + attributes.insert(attribute->name()); } - d->_attributes = attrs.toList(); + + d->_attributes = attributes.toList(); +} + +void QQuickPath::componentComplete() +{ + Q_D(QQuickPath); + d->componentComplete = true; + + gatherAttributes(); processPath(); - foreach (QQuickPathElement *pathElement, d->_pathElements) - connect(pathElement, SIGNAL(changed()), this, SLOT(processPath())); + connectPathElements(); } QPainterPath QQuickPath::path() const |