QTP0004

QML 模块中包含 QML 文件的额外目录需要额外的 qmldir 文件。

此策略在 Qt 6.8 中引入。它会导致构建系统为 QML 模块中包含 QML 文件的每个额外目录生成一个额外的 qmldir 文件。

启用此策略可确保模块中每个 QML 组件的隐式导入与模块本身相同。这意味着所有组件无需显式导入模块即可相互看到。

OLD 该策略的行为是只为模块的根目录生成 qmldir 文件。

NEW 该策略的行为是,模块中包含 QML 文件的每个目录都会生成一个单独的 qmldir 文件。

如果没有明确设置该策略,Qt 6.8 会发出警告。

注意: OLD 策略行为已被弃用,将来可能会被移除。

另请参阅 qt_policyqt_standard_project_setup()qt_cmake_policiesqt_add_qml_module

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.