diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-05-31 10:38:07 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-06-23 09:35:57 +0200 |
commit | 6aad465f080e4b0c5f7d1b0944bdd864e19d5783 (patch) | |
tree | 25a069579edd571e5ed7ebb7e9342b217fa4cc54 /src/qml/doc/snippets | |
parent | 6a0ab2e8aa0bcc2487ae895033b493a9e4d7704b (diff) | |
download | qtdeclarative-6aad465f080e4b0c5f7d1b0944bdd864e19d5783.tar.gz |
Introduce a sane resource path to qt_add_qml_module
Since "/qt" is reserved, we can use "/qt/qml" as the default path for
user QML modules.
[ChangeLog][QtQml] The AUTO_RESOURCE_PREFIX option was added to
qt_add_qml_module(). It places your QML modules in the otherwise
reserved resource directory /qt/qml. This directory is also added to the
default QML import path. By using it you don't have to specify custom
import paths anymore. Specifying neither AUTO_RESOURCE_PREFIX nor an
explicit RESOURCE_PREFIX will generate a warning now because such QML
modules are likely invisible in the resource file system.
Fixes: QTBUG-95145
Fixes: QTBUG-103452
Change-Id: Ie27dec5cbf34ea06258d55c659d202cdd61e54b2
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/qml/doc/snippets')
-rw-r--r-- | src/qml/doc/snippets/qmltc/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/doc/snippets/qmltc/CMakeLists.txt b/src/qml/doc/snippets/qmltc/CMakeLists.txt index aa5fa8e230..30c1e0db0e 100644 --- a/src/qml/doc/snippets/qmltc/CMakeLists.txt +++ b/src/qml/doc/snippets/qmltc/CMakeLists.txt @@ -44,6 +44,7 @@ target_compile_definitions(${application_name} PRIVATE qt6_add_qml_module(${application_name} VERSION 1.0 URI QmltcExample + AUTO_RESOURCE_PREFIX QML_FILES ${application_qml_files} # Compile qml files (listed in QML_FILES) to C++ using qmltc and add these diff --git a/src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp b/src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp index c933adfcaf..e74a9eec84 100644 --- a/src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp +++ b/src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp @@ -81,7 +81,8 @@ void tst_qmltc_examples::appComponent() QQuickWindow window; QQmlComponent component(&e); - component.loadUrl(QUrl(QStringLiteral("qrc:/QmltcExample/myApp.qml"))); + component.loadUrl( + QUrl(QStringLiteral("qrc:/qt/qml/QmltcExample/myApp.qml"))); //! [qqmlcomponent-app-code-0] QVERIFY2(!component.isError(), qPrintable(component.errorString())); |