Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
Qt Creator 13.0.0
-
None
-
Ubuntu 22.04, CMake 3.22.1, Qt SDK 6.5.5
Description
In my `CMakeLists.txt` I have:
qt_add_qml_module(MyModule URI MyModule VERSION 1.0 RESOURCE_PREFIX / QML_FILES ${QML_SOURCE_FILES} )
I have configured some of the QML-files as SINGLETONS:
set_source_files_properties(MySingleton.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
Seems that these singletons won't work without explicitly importing my `MyModule` in Main.qml:
import QtCore import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Controls.Universal 2.15 import QtQuick.Dialogs import QtQuick.Effects import MyModule // This is needed to make singletons work. See the auto-generated qmldir-files.
This works fine, but `Qt Creator` doesn't understand the import line (it says that QML module is not found):
However, another topic would be that why singletons require this import in the first place.