summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcontext.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-08-18 07:59:31 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-08-18 07:59:31 (GMT)
commit223746067a9a1b3f5c6195868b5e510311608ca1 (patch)
treef8dfc604a035075e4a7e6d20e0930a6c6cfc4db8 /src/declarative/qml/qmlcontext.cpp
parente4fad48d5e5ac227381bb9fba05dfb31a8338ed5 (diff)
downloadQt-223746067a9a1b3f5c6195868b5e510311608ca1.zip
Qt-223746067a9a1b3f5c6195868b5e510311608ca1.tar.gz
Qt-223746067a9a1b3f5c6195868b5e510311608ca1.tar.bz2
Resolve attached property typenames in correct context.
The imports of the component containing the reference to the attached property are used to resolve typenames, rather than assuming "Qt" namespace.
Diffstat (limited to 'src/declarative/qml/qmlcontext.cpp')
-rw-r--r--src/declarative/qml/qmlcontext.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp
index 451dbcc..b73471a 100644
--- a/src/declarative/qml/qmlcontext.cpp
+++ b/src/declarative/qml/qmlcontext.cpp
@@ -451,4 +451,22 @@ void QmlContext::setBaseUrl(const QUrl &baseUrl)
d_func()->url = baseUrl;
}
+/*!
+ Returns the base url of the component, or the containing component
+ if none is set.
+*/
+QUrl QmlContext::baseUrl() const
+{
+ Q_D(const QmlContext);
+ const QmlContext* p = this;
+ while (p && p->d_func()->url.isEmpty()) {
+ p = p->parentContext();
+ }
+ if (p)
+ return p->d_func()->url;
+ else
+ return QUrl();
+}
+
+
QT_END_NAMESPACE