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