Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt Creator complains Unknown component M300 for items from library
Qt 6.11 is out! See what's new in the release blog

Qt Creator complains Unknown component M300 for items from library

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SebastianMS Offline
    SebastianMS Offline
    SebastianM
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • SebastianMS Offline
      SebastianMS Offline
      SebastianM
      wrote on last edited by
      #2

      When I moved whole content of components to Module. Added qmldir and explicitly enumerate all files inside.
      After that

      set(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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved