diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2010-02-23 08:24:31 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2010-02-23 08:24:31 (GMT) |
commit | a948f901b196bab121cb8b5736204b4ce0c09e94 (patch) | |
tree | e87ac8e797b93203998c1bbb32c2e1120567b137 /src/declarative/qml/qmlcontext.cpp | |
parent | ac99b3e243b331d26815b80aab97cdaf0ed06b0f (diff) | |
parent | 2e417e2a3963151a2b3a3033e6f5bb0e106d8db4 (diff) | |
download | Qt-a948f901b196bab121cb8b5736204b4ce0c09e94.zip Qt-a948f901b196bab121cb8b5736204b4ce0c09e94.tar.gz Qt-a948f901b196bab121cb8b5736204b4ce0c09e94.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2
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 303af42..56038cf 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -544,5 +544,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 |