Issue

  • QML module not found
  • Examples > Application Examples >Coffee Machine Project

Solution

  • CMakeLists.txt 에 project's Imports 경로 추가
  • add the following command to the CMakeLists.txt file to set the QML import path

CMakeLists.txt 에 Imports 경로 추가

# Directories where Qt Creator can find QML files.
# (Not needed for builds, but makes Qt Creator code completion happy.)
list(APPEND QML_IMPORT_PATH "/home/basiclike/Qt/Examples/Qt-6.5.2/demos/coffee/imports")

# Prevent adding duplicate values at each run of CMake.
list(REMOVE_DUPLICATES QML_IMPORT_PATH)

# The variable is cached in ${BUILD_DIR}/CMakeCache.txt. We need FORCE to 
# change it there immediately. Also, add a comment to the cache file.
set(QML_IMPORT_PATH ${QML_IMPORT_PATH}
    CACHE STRING ""
    FORCE
)

 

It works :)