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. import Components - Qt creator show M300 Unknown Component

import Components - Qt creator show M300 Unknown Component

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 783 Views
  • 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.
  • DiackneD Offline
    DiackneD Offline
    Diackne
    wrote on last edited by Diackne
    #1

    Hi,

    I try Local Directory Imports into a qualified local namespace but without success ,   but if i import by qrc the application builds and runs like expected but in Qt Creator the auto-completation doesn't work, and the Components imported into a qualified fails, not recognized at all the Qt creator show the error "M300 Unknown Component". 
    I found some related Qt Creator issues reported in pass:

    QTCREATORBUG-28414
    QTCREATORBUG-22392
    QTCREATORBUG-22839
    QTCREATORBUG-19637

    I think the problem is when import not in app directory

    ├── appX
    |     ├── mycomponents.qrc
    |     └── main.qml  
    |
    ├── appY
    |     ├── mycomponents.qrc
    |     └── main.qml  
    |
    └── shared
           └──  mycomponents              
                 ├── Component1.qml            
                 └── Component2.qml
    

    mycomponents.qrc

    <RCC>
        <qresource prefix="/MyComponents">
            <file alias="Component1.qml">../shared/mycomponents/Component1.qml</file>
            <file alias="Component2.qml">../shared/mycomponents/Component2.qml</file>
        </qresource>
    </RCC>
    

    when I try import like this in appX/main.qml

    import "qrc:/MyComponents" as MyComponents
    
    MyComponents.Component1 {
        // ...
    }
    

    this way works build and run but in Qt Creator not recognized show the error "M300 Unknown Component"

    in other way I try relative path

    import "../shared/mycomponents" as MyComponents
    
    MyComponents.Component1 {
        // ...
    }
    

    This way Qt Creator recognized the Components, but application show the error  "../shared/mycomponents": no such directory, i import qml path in cmake, but it doesn't work

    Is there any way to work on both? Any ideas?
    I appreciate any help.

    1 Reply Last reply
    0
    • E Offline
      E Offline
      erii
      wrote on last edited by
      #2

      I am a beginner in QML, and this problem has been bothering me for a long time. I have encountered the same phenomenon. Do you have a solution?

      DiackneD 1 Reply Last reply
      0
      • E erii

        I am a beginner in QML, and this problem has been bothering me for a long time. I have encountered the same phenomenon. Do you have a solution?

        DiackneD Offline
        DiackneD Offline
        Diackne
        wrote on last edited by
        #3

        Hi,
        So far, I haven't found a solution...
        And it's a very specific issue in QT Creator, I found others developers with the same problem. I open an issue bugreports:

        @erii https://bugreports.qt.io/browse/QTCREATORBUG-31243

        But I don't have much hope that they will resolve this, are similar issues in bugreports, and they were ignored or closed... it's not the main focus Qt team

        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