Solved Qt Creator complains Unknown component M300 for items from library
-
Hi,
Linux, Qt 5.15, Creator 5.0.2, CMake 3.21
I've got two binary apps using similar set of components. So I moved those components to common library project, add library dependency and Q_INIT_RESOURCES call.
When I run both app GUI is displayed properly, components are found, no errors and warnings.
However Qt Creator complains with "Unknown component {M300}".
In CMakeList for binary apps I provided QML_IMPORT_PATH, QML2_IMPORT_PATH and QML_DESIGNER_IMPORT_PATH.set(QML_IMPORT_PATH ${CMAKE_CURRENT_LIST_DIR}/qml ${CMAKE_CURRENT_LIST_DIR}/../common ${CMAKE_CURRENT_LIST_DIR}/../common/assets/components ${CMAKE_SOURCE_DIR}/imports CACHE STRING "" FORCE) set(QML2_IMPORT_PATH ${CMAKE_CURRENT_LIST_DIR}/qml ${CMAKE_CURRENT_LIST_DIR}/../common ${CMAKE_CURRENT_LIST_DIR}/../common/assets/components ${CMAKE_SOURCE_DIR}/imports CACHE STRING "" FORCE) set(QML_DESIGNER_IMPORT_PATH ${CMAKE_CURRENT_LIST_DIR}/qml ${CMAKE_CURRENT_LIST_DIR}/../common ${CMAKE_CURRENT_LIST_DIR}/../common/assets/components ${CMAKE_SOURCE_DIR}/imports CACHE STRING "" FORCE)
I called Tools->Qml/Js->Reset code model multiple times.
Restarted Qt Creator.
Deleted whole build folder and recreate it.
What variable should I set to make common component visible and recognisable for Qt Creator? -
When I moved whole content of components to Module. Added
qmldir
and explicitly enumerate all files inside.
After thatset(QML_IMPORT_PATH ${CMAKE_CURRENT_LIST_DIR}/qml ${CMAKE_SOURCE_DIR}/common CACHE STRING "" FORCE)
was enough for Qt Creator to find missing or unknown components.