diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-02-07 16:22:53 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-17 14:44:26 +0100 |
commit | f4937a21b61bf2f214d175d77c432c68f25ead21 (patch) | |
tree | a9753103192cf6310913ed3127bf48d80aed8462 /tests | |
parent | 1eb20d70619cc896fc283bd6605b257a8750c518 (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 'tests')
-rw-r--r-- | tests/auto/qml/qqmlengine/tst_qqmlengine.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qml/qqmlimport/tst_qqmlimport.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp | 2 | ||||
-rw-r--r-- | tests/auto/quick/qquickimage/tst_qquickimage.cpp | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index 0081243a88..35071997ec 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -852,7 +852,7 @@ void tst_qqmlengine::urlInterceptor() e.addImportPath(testFileUrl("interception/imports").url()); CustomSelector cs(testFileUrl("")); cs.m_interceptionPoints = interceptionPoint; - e.setUrlInterceptor(&cs); + e.addUrlInterceptor(&cs); QQmlComponent c(&e, testFile); //Note that this can get intercepted too QObject *o = c.create(); if (!o) diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp index e332d86338..d5d2b061e9 100644 --- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp +++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp @@ -233,7 +233,7 @@ void tst_QQmlImport::interceptQmldir() { QQmlEngine engine; QmldirUrlInterceptor interceptor; - engine.setUrlInterceptor(&interceptor); + engine.addUrlInterceptor(&interceptor); QQmlComponent component(&engine); component.loadUrl(testFileUrl("interceptQmldir.qml")); diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index 9ec3e9557b..8a82db3456 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -419,7 +419,7 @@ void tst_QQMLTypeLoader::intercept() UrlInterceptor interceptor; NetworkAccessManagerFactory factory; - engine.setUrlInterceptor(&interceptor); + engine.addUrlInterceptor(&interceptor); engine.setNetworkAccessManagerFactory(&factory); QQmlComponent component(&engine, testFileUrl("test_intercept.qml")); diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index f0b44743b9..5dca698cfe 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -1193,7 +1193,7 @@ void tst_qquickimage::urlInterceptor() { QQmlEngine engine; MyInterceptor interceptor {testFileUrl("colors.png")}; - engine.setUrlInterceptor(&interceptor); + engine.addUrlInterceptor(&interceptor); QQmlComponent c(&engine); |