':/qt/qml/' is the default resource prefix for QML modules.
This policy was introduced in Qt 6.5. It changes where qt_add_qml_module() stores QML resources in the resource system.
Enabling this policy ensures that your QML module is placed under a default import 路径 , and its types can be found without manual calls to QQmlEngine::addImportPath .
The
OLD
behavior of this policy is that, the
RESOURCE_PREFIX
argument for
qt_add_qml_module()
默认为
":/"
.
The
NEW
behavior of this policy is that the
RESOURCE_PREFIX
argument for
qt_add_qml_module()
默认为
":/qt/qml/"
. The new behavior ensures that modules are put into the
QML 导入路径
and can be found without further setup.
Qt 6.5 issues warnings if you do not pass any of the following arguments to the
qt_add_qml_module
命令:
RESOURCE_PREFIX
,
NO_RESOURCE_TARGET_PATH
。使用
qt_policy
command to suppress the warning by explicitly setting the policy to
OLD
or
NEW
.
注意:
The
OLD
behavior of a policy is deprecated, and may be removed in the future.
另请参阅 qt_policy , qt_standard_project_setup() , qt_cmake_policies ,和 qt_add_qml_module .