QTP0004 | Qt Qml | Qt 6.11.0
Description: Extra directories with QML files in a QML module need extra qmldir files.

- Qt 6.11
- Qt Qml
- CMake Integration for QML
- CMake Policies for QML
- QTP0004
- Qt 6.11.0 Reference Documentation

QTP0001 ◦ QTP0005

# QTP0004

Extra directories with QML files in a QML module need extra qmldir files.

This policy was introduced in Qt 6.8. It causes the build system to generate an extra qmldir file for each additional directory that contains QML files in a QML module.

Enabling this policy ensures that the implicit import of each of the QML components in your module is the same as the module itself. This means that all the components can see each other without explicitly importing the module.

The `OLD` behavior of this policy is that a qmldir file is only generated for the root directory of a module.

The `NEW` behavior of this policy is that for each directory with QML files in a module a separate qmldir file is generated.

Qt 6.8 issues warnings if you do not explicitly set the policy.

Note: The `OLD` behavior of a policy is deprecated, and may be removed in the future.

See also qt_policy, qt_standard_project_setup(), qt_cmake_policies, and qt_add_qml_module.

QTP0001 ◦ QTP0005