I have a .qml file with a component 2 steps above in my project path because I want to have a component folder above many projects to be shared by all/some of these. So in my main.qml I do:
import 'qrc:/../../components'
That works and I can use my qml component from file. However in the design view, I get the warning:
found not working imports: ...(file and import line number where the import is) "qrc:/../../components": no such directory
Many other things I tried make the project not compile or throwns error at runtime.
Trial1: import "qrc:/"
: compile time error: Unknown component. (M300)
. Makes sense as the component is in a path above.
Trial2: import './../../components'
: runtime error: import "./../../components" has no qmldir and no namespace
.
Tried also to put a qmldir file in my components folder where my component is with the text "MyComponent MyComponent.qml" as explained in Importing QML Document Directories
Apart from the warning everything works fine. Project compiles, runs and the changes in the component are shown when I work in the design view.
info:
-> component resource is added to the qml.qrc, and the file exists (projecets works)
-> QtQuick version QtQuick 2.9
-> Qt Creator 4.15.2 Based on Qt 5.15.2
How do I get rid of the warning?
from warning only in design view on import statement to use qml component from file
No comments:
Post a Comment