diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-23 00:52:04 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-23 00:52:04 (GMT) |
commit | 3b1ec46d388cc1404522730b27ee711ffa888520 (patch) | |
tree | 92ac5e6f2ff0a895cf3eac2825af9c63beabc0f5 | |
parent | ba602c39e2ab7c16dcb212c935dbacdf053c6623 (diff) | |
download | Qt-3b1ec46d388cc1404522730b27ee711ffa888520.zip Qt-3b1ec46d388cc1404522730b27ee711ffa888520.tar.gz Qt-3b1ec46d388cc1404522730b27ee711ffa888520.tar.bz2 |
Add accessor for QmlComponent's creation context
-rw-r--r-- | src/declarative/qml/qmlcomponent.cpp | 15 | ||||
-rw-r--r-- | src/declarative/qml/qmlcomponent.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index 0c85574..12fb120 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -385,6 +385,21 @@ void QmlComponent::setData(const QByteArray &data, const QUrl &url) } /*! +Returns the QmlContext the component was created in. This is only +valid for components created directly from QML. +*/ +QmlContext *QmlComponent::creationContext() const +{ + Q_D(const QmlComponent); + + QmlDeclarativeData *ddata = QmlDeclarativeData::get(this); + if (ddata) + return ddata->context; + else + return 0; +} + +/*! Load the QmlComponent from the provided \a url. */ void QmlComponent::loadUrl(const QUrl &url) diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qmlcomponent.h index 7470f31..a72aa4e 100644 --- a/src/declarative/qml/qmlcomponent.h +++ b/src/declarative/qml/qmlcomponent.h @@ -96,6 +96,8 @@ public: void loadUrl(const QUrl &url); void setData(const QByteArray &, const QUrl &baseUrl); + QmlContext *creationContext() const; + static QmlComponentAttached *qmlAttachedProperties(QObject *); Q_SIGNALS: |