diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-23 12:02:52 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-23 12:02:52 (GMT) |
commit | de4332a4728e739b37e9c7b04c021e150e096270 (patch) | |
tree | 619aae505826654f3d89492efa53f758214fea6f /src/declarative/qml/qmlcontext.cpp | |
parent | a419d587a666aaf55310b3a18e9f9e1993fef16e (diff) | |
parent | 3db40b0be40c946f547f238ed3f0af813892115e (diff) | |
download | Qt-de4332a4728e739b37e9c7b04c021e150e096270.zip Qt-de4332a4728e739b37e9c7b04c021e150e096270.tar.gz Qt-de4332a4728e739b37e9c7b04c021e150e096270.tar.bz2 |
Merge remote branch 'origin/master'
Conflicts:
doc/src/declarative/advtutorial1.qdoc
doc/src/declarative/tutorial2.qdoc
doc/src/declarative/tutorial3.qdoc
src/declarative/graphicsitems/qmlgraphicsmousearea.cpp
src/multimedia/playback/qmediaplayer.cpp
Diffstat (limited to 'src/declarative/qml/qmlcontext.cpp')
-rw-r--r-- | src/declarative/qml/qmlcontext.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index 1cd550d..1718387 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -545,5 +545,30 @@ QUrl QmlContext::baseUrl() const return QUrl(); } +int QmlContextPrivate::context_count(QmlListProperty<QObject> *prop) +{ + QmlContext *context = static_cast<QmlContext*>(prop->object); + QmlContextPrivate *d = QmlContextPrivate::get(context); + int contextProperty = (int)(intptr_t)prop->data; + + if (d->propertyValues.at(contextProperty).userType() != qMetaTypeId<QList<QObject*> >()) { + return 0; + } else { + return ((const QList<QObject> *)d->propertyValues.at(contextProperty).constData())->count(); + } +} + +QObject *QmlContextPrivate::context_at(QmlListProperty<QObject> *prop, int index) +{ + QmlContext *context = static_cast<QmlContext*>(prop->object); + QmlContextPrivate *d = QmlContextPrivate::get(context); + int contextProperty = (int)(intptr_t)prop->data; + + if (d->propertyValues.at(contextProperty).userType() != qMetaTypeId<QList<QObject*> >()) { + return 0; + } else { + return ((const QList<QObject*> *)d->propertyValues.at(contextProperty).constData())->at(index); + } +} QT_END_NAMESPACE |