aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-02-07 16:22:53 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-03-17 14:44:26 +0100
commitf4937a21b61bf2f214d175d77c432c68f25ead21 (patch)
treea9753103192cf6310913ed3127bf48d80aed8462 /src/qml/jsruntime
parent1eb20d70619cc896fc283bd6605b257a8750c518 (diff)
Allow multiple URL interceptors per engine
We may want to have, for example, a QQmlFileSelector and a component-specific interceptor that chooses a theme or similar. Also, make the API public. We want to propose this as alternative to dynamically registering QML files via qmlRegisterType(QUrl, ...). Change-Id: I4a535d3ea556da6710fde816579ec188b3f57099 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4include.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp
index 92face6f94..745ffab0cd 100644
--- a/src/qml/jsruntime/qv4include.cpp
+++ b/src/qml/jsruntime/qv4include.cpp
@@ -218,8 +218,8 @@ QV4::ReturnedValue QV4Include::method_include(const QV4::FunctionObject *b, cons
callbackFunction = argv[1];
QUrl url(scope.engine->resolvedUrl(argv[0].toQStringNoThrow()));
- if (scope.engine->qmlEngine() && scope.engine->qmlEngine()->urlInterceptor())
- url = scope.engine->qmlEngine()->urlInterceptor()->intercept(url, QQmlAbstractUrlInterceptor::JavaScriptFile);
+ if (const QQmlEngine *qmlEngine = scope.engine->qmlEngine())
+ url = qmlEngine->interceptUrl(url, QQmlAbstractUrlInterceptor::JavaScriptFile);
QString localFile = QQmlFile::urlToLocalFileOrQrc(url);