diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-08-18 07:59:31 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-08-18 07:59:31 (GMT) |
commit | 223746067a9a1b3f5c6195868b5e510311608ca1 (patch) | |
tree | f8dfc604a035075e4a7e6d20e0930a6c6cfc4db8 /src/declarative/qml/qmlcontext.cpp | |
parent | e4fad48d5e5ac227381bb9fba05dfb31a8338ed5 (diff) | |
download | Qt-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.cpp | 18 |
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 |