QTP0001

„:/qt/qml/“ ist das Standard-Ressourcenpräfix für QML-Module.

Diese Richtlinie wurde in Qt 6.5 eingeführt. Sie legt fest, wo qt_add_qml_module() QML-Ressourcen im Ressourcensystem ablegt.

Durch Aktivieren dieser Richtlinie wird sichergestellt, dass Ihr QML-Modul unter einem Standard-Importpfad abgelegt wird und seine Typen ohne manuelle Aufrufe von ` QQmlEngine::addImportPath` gefunden werden können.

Das Verhalten von ` OLD ` bei dieser Richtlinie besteht darin, dass das Argument ` RESOURCE_PREFIX ` für ` qt_add_qml_module() ` standardmäßig auf ` "/"` gesetzt wird.

Das Verhalten von „ NEW “ im Rahmen dieser Richtlinie sieht vor, dass das Argument „ RESOURCE_PREFIX “ für „ qt_add_qml_module() “ standardmäßig auf „ "/qt/qml/" “ gesetzt wird. Das neue Verhalten stellt sicher, dass Module in den QML-Importpfad aufgenommen werden und ohne weitere Konfiguration gefunden werden können.

Qt 6.5 gibt Warnungen aus, wenn Sie keines der folgenden Argumente an den Befehl „ qt_add_qml_module “ übergeben: „ RESOURCE_PREFIX “, „ NO_RESOURCE_TARGET_PATH “. Verwenden Sie den Befehl „qt_policy()“, um die Warnung zu unterdrücken, indem Sie die Richtlinie explizit auf „ OLD “ oder „ NEW “ setzen.

Hinweis: Das Verhalten „ OLD “ einer Richtlinie ist veraltet und wird möglicherweise in Zukunft entfernt.

Siehe auch qt_policy(), qt_standard_project_setup(), qt_cmake_policies und qt_add_qml_module().

© 2026 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.