diff options
author | Marco Bubke <marco.bubke@digia.com> | 2013-04-24 13:52:10 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-24 21:36:01 +0200 |
commit | 7c683dd625421f33a5456c3bdd457c6e4072a64d (patch) | |
tree | 3c7e0d373c8c7ed34c8384c6b4b7e6f71581609e /src/quick | |
parent | e65835789c8022d7105f05679a64fd468c5b44d2 (diff) |
Refactor the pathElements property in QQuickPath
A prequel to make QQuickPath pathElements designer ready.
Change-Id: I1f3e30c699c958c827fdecfb57c35f5c24cd810a
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/util/qquickpath.cpp | 43 | ||||
-rw-r--r-- | src/quick/util/qquickpath_p.h | 6 |
2 files changed, 47 insertions, 2 deletions
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index 49b9e4c4e3..0b0c330e73 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -188,8 +188,47 @@ bool QQuickPath::hasEnd() const QQmlListProperty<QQuickPathElement> QQuickPath::pathElements() { - Q_D(QQuickPath); - return QQmlListProperty<QQuickPathElement>(this, d->_pathElements); + return QQmlListProperty<QQuickPathElement>(this, + 0, + pathElements_append, + pathElements_count, + pathElements_at, + pathElements_clear); +} + +static QQuickPathPrivate *privatePath(QObject *object) +{ + QQuickPath *path = static_cast<QQuickPath*>(object); + + return QQuickPathPrivate::get(path); +} + +QQuickPathElement *QQuickPath::pathElements_at(QQmlListProperty<QQuickPathElement> *property, int index) +{ + QQuickPathPrivate *d = privatePath(property->object); + + return d->_pathElements.at(index); +} + +void QQuickPath::pathElements_append(QQmlListProperty<QQuickPathElement> *property, QQuickPathElement *pathElement) +{ + QQuickPathPrivate *d = privatePath(property->object); + + d->_pathElements.append(pathElement); +} + +int QQuickPath::pathElements_count(QQmlListProperty<QQuickPathElement> *property) +{ + QQuickPathPrivate *d = privatePath(property->object); + + return d->_pathElements.count(); +} + +void QQuickPath::pathElements_clear(QQmlListProperty<QQuickPathElement> *property) +{ + QQuickPathPrivate *d = privatePath(property->object); + + d->_pathElements.clear(); } void QQuickPath::interpolate(int idx, const QString &name, qreal value) diff --git a/src/quick/util/qquickpath_p.h b/src/quick/util/qquickpath_p.h index cbb8566d99..1a9be7c82a 100644 --- a/src/quick/util/qquickpath_p.h +++ b/src/quick/util/qquickpath_p.h @@ -397,6 +397,12 @@ protected: void connectPathElements(); void gatherAttributes(); + // pathElements property + static QQuickPathElement *pathElements_at(QQmlListProperty<QQuickPathElement> *, int); + static void pathElements_append(QQmlListProperty<QQuickPathElement> *, QQuickPathElement *); + static int pathElements_count(QQmlListProperty<QQuickPathElement> *); + static void pathElements_clear(QQmlListProperty<QQuickPathElement> *); + private Q_SLOTS: void processPath(); |