summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcomponent.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-23 00:52:04 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-23 00:52:04 (GMT)
commit3b1ec46d388cc1404522730b27ee711ffa888520 (patch)
tree92ac5e6f2ff0a895cf3eac2825af9c63beabc0f5 /src/declarative/qml/qmlcomponent.cpp
parentba602c39e2ab7c16dcb212c935dbacdf053c6623 (diff)
downloadQt-3b1ec46d388cc1404522730b27ee711ffa888520.zip
Qt-3b1ec46d388cc1404522730b27ee711ffa888520.tar.gz
Qt-3b1ec46d388cc1404522730b27ee711ffa888520.tar.bz2
Add accessor for QmlComponent's creation context
Diffstat (limited to 'src/declarative/qml/qmlcomponent.cpp')
-rw-r--r--src/declarative/qml/qmlcomponent.cpp15
1 files changed, 15 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)