aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Masoud Abdol <amir.abdol@qt.io>2023-02-07 15:16:53 +0100
committerAmir Masoud Abdol <amir.abdol@qt.io>2023-02-21 12:14:00 +0100
commitaed498e2fb2fda89fb8b587fce310693175de86c (patch)
treee19fe96b0813d0e04972c65ab7cb6b01d018a919
parent851d84a63cef74b5c803f9bd2611051567c6dd01 (diff)
Remove AUTO_RESOURCE_PREFIX, and refer to QTP0001 when possible
Pick-to: 6.5 Task-number: QTBUG-96233 Change-Id: I4126760dddc9ec1b5c8850fb30a80730e19cb307 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--src/qml/doc/snippets/qmltc/CMakeLists.txt3
-rw-r--r--src/qml/doc/src/cmake/policy/qtp0001.qdoc9
-rw-r--r--src/qml/doc/src/cmake/qt_add_qml_module.qdoc10
-rw-r--r--src/qml/doc/src/qtqml-writing-a-module.qdoc12
4 files changed, 16 insertions, 18 deletions
diff --git a/src/qml/doc/snippets/qmltc/CMakeLists.txt b/src/qml/doc/snippets/qmltc/CMakeLists.txt
index 4be5a96528..2c5e91c6cf 100644
--- a/src/qml/doc/snippets/qmltc/CMakeLists.txt
+++ b/src/qml/doc/snippets/qmltc/CMakeLists.txt
@@ -42,11 +42,12 @@ target_compile_definitions(${application_name} PRIVATE
QMLTC_TESTS_BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}"
)
+qt_policy(SET QTP0001 NEW)
+
#! [qmltc-add-qml-module]
# Make the application into a proper QML module:
qt6_add_qml_module(${application_name}
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/src/cmake/policy/qtp0001.qdoc b/src/qml/doc/src/cmake/policy/qtp0001.qdoc
index a5381647c9..a8accc5fa3 100644
--- a/src/qml/doc/src/cmake/policy/qtp0001.qdoc
+++ b/src/qml/doc/src/cmake/policy/qtp0001.qdoc
@@ -14,8 +14,7 @@ This policy was introduced in Qt 6.5. It changes where
\l{qt_add_qml_module}{qt_add_qml_module()} stores QML resources in
the resource system.
-The \c OLD behavior of this policy is that, unless
-\c AUTO_RESOURCE_PREFIX is set, the \c RESOURCE_PREFIX argument for
+The \c OLD behavior of this policy is that, the \c RESOURCE_PREFIX argument for
\c{qt_add_qml_module()} defaults to \c{":/"}.
The \c NEW behavior of this policy is that the \c RESOURCE_PREFIX argument
@@ -24,9 +23,9 @@ ensures that modules are put into the \l{QML Import Path} and can be
found without further setup.
Qt 6.5 issues warnings if you do not pass any of the following arguments to the
-\c qt_add_qml_module command: \c RESOURCE_PREFIX, \c AUTO_RESOURCE_PREFIX,
-\c NO_RESOURCE_TARGET_PATH. Use the \l qt_policy command to suppress
-the warning by explicitly setting the policy to \c OLD or \c NEW.
+\c qt_add_qml_module command: \c RESOURCE_PREFIX, \c NO_RESOURCE_TARGET_PATH.
+Use the \l qt_policy command to suppress the warning by explicitly setting
+the policy to \c OLD or \c NEW.
\note The \c{OLD} behavior of a policy is deprecated, and may
be removed in the future.
diff --git a/src/qml/doc/src/cmake/qt_add_qml_module.qdoc b/src/qml/doc/src/cmake/qt_add_qml_module.qdoc
index 404915cdbe..ff5592e545 100644
--- a/src/qml/doc/src/cmake/qt_add_qml_module.qdoc
+++ b/src/qml/doc/src/cmake/qt_add_qml_module.qdoc
@@ -23,7 +23,6 @@ qt_add_qml_module(
[STATIC | SHARED]
[PLUGIN_TARGET plugin_target]
[OUTPUT_DIRECTORY output_dir]
- [AUTO_RESOURCE_PREFIX]
[RESOURCE_PREFIX resource_prefix]
[CLASS_NAME class_name]
[TYPEINFO typeinfo]
@@ -212,11 +211,10 @@ current source directory (\c CMAKE_CURRENT_SOURCE_DIR). This resource path is
appended to a prefix formed by concatenating the \l{RESOURCE_PREFIX} and
the target path (but see \l NO_RESOURCE_TARGET_PATH for an exception to this).
-Since Qt 6.5, you can specify \l{AUTO_RESOURCE_PREFIX}. If
-\l{AUTO_RESOURCE_PREFIX} is specified, \l{RESOURCE_PREFIX} is set to
-\c{/qt/qml}. This way, your modules are automatically
-placed in the default import path of the QML engine. If you don't do this, you
-should set up a \l{QML Import Path} to point to your resource prefix.
+If \l{QTP0001} policy is set to \c NEW, the \l{RESOURCE_PREFIX} defaults
+to \c{/qt/qml/} which is the default import path of the QML engine.
+This ensures that modules are put into the \l{QML Import Path} and can be
+found without further setup.
Ordinarily, the project should aim to place \c{.qml} files in
the same relative location as they would have in the resources. If the \c{.qml}
diff --git a/src/qml/doc/src/qtqml-writing-a-module.qdoc b/src/qml/doc/src/qtqml-writing-a-module.qdoc
index 68566f984a..df72766af4 100644
--- a/src/qml/doc/src/qtqml-writing-a-module.qdoc
+++ b/src/qml/doc/src/qtqml-writing-a-module.qdoc
@@ -143,7 +143,7 @@ In more complex projects, this convention can be too limiting. You might for
instance want to group all QML modules in one place to avoid polluting the
project's root directory. Or you want to reuse a single module in multiple
applications. For those cases, \c QT_QML_OUTPUT_DIRECTORY in combination with
-\c RESOURCE_PREFIX or \c AUTO_RESOURCE_PREFIX and \l IMPORT_PATH can be used.
+\c RESOURCE_PREFIX and \l IMPORT_PATH can be used.
To collect QML modules into a specific output directory, for example a
subdirectory "qml" in the build directory \l QT_QML_OUTPUT_DIRECTORY, set the
@@ -206,11 +206,11 @@ qt_add_qml_module(
If all QML modules are always loaded from the resource
file system, you can deploy the application as a single binary.
-Generally, you should pass the \c AUTO_RESOURCE_PREFIX without arguments to
-\l{qt_add_qml_module}. This way, your modules are placed in
-\c{:/qt/qml/} in the resource file system. Since Qt 6.5,
-this is part of the default \l{QML Import Path}, but not used by Qt itself. For
-modules to be used within your application, this is the right place.
+If \l{QTP0001} policy is set to \c NEW, the \c RESOURCE_PREFIX argument
+for \c{qt_add_qml_module()} defaults to \c{/qt/qml/}, therefore your
+modules are placed in \c{:/qt/qml/} in the resource file system.
+This is part of the default \l{QML Import Path}, but not used by Qt
+itself. For modules to be used within your application, this is the right place.
If you have instead specified a custom \c RESOURCE_PREFIX, you have to add the
custom resource prefix to the \l{QML Import Path}. You can also add multiple