Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
6.2.2
-
None
-
CMake-3.22.1
Qt-6.2.2
Description
I am creating a Qt6 QML module with qt_add_qml_module.
qt_add_qml_module(SQUtils_Logger_Qml URI SQUtilsLogger.Qml VERSION 1.0 SOURCES LoggerQml.cpp QML_FILES Log.js Logm.mjs LoggerQml.qml )
But the generated qmldir contains only the information about the qml file: the js and mjs files are missing.
module SQUtils.Logger.Qml linktarget SQUtils_Logger_Qmlplugin optional plugin SQUtils_Logger_Qmlplugin classname SQUtils_Logger_QmlPlugin typeinfo SQUtils_Logger_Qml.qmltypes prefer :/SQUtils/Logger/Qml/ LoggerQml 1.0 LoggerQml.qml
It is a problem because when I run "ninja all_qmllint", the compiler/linter complains that Log is not defined:
// View.qml import SQUtils_Logger_Qml //import "qrc:/SQUtils/Logger/Qml/Log.js" as Log ApplicationWindow { Component.onCompleted: { Log.debug("QML main application complete") } }
Warning: View.qml:120:13: Unqualified access Log.debug("QML main application complete)
If I append "Log 1.0 Log.js" to the qmldir file, then the lint works.
What I am doing wrong? Is this a bug? The qt documentation for qt_add_qml_module indeed quotes:
QML_FILES lists the .qml, .js and .mjs files for the module. [...] The files will also be used to populate type information in the generated qmldir file.
Thank you for your help!
Note: I can manage to run my code by uncommenting
import "qrc:/SQUtils/Logger/Qml/Log.js" as Log
but the lint still does not work.
Attachments
Issue Links
- duplicates
-
QTBUG-100326 *.mjs files not added to qmldir when added to qt_add_qml_module()
-
- Closed
-
- resulted in
-
QTBUG-126510 [REG 6.6 -> 6.7] Type error due to clash between JS and Qml type names
-
- Closed
-