Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

140
Visualizações
warning only in design view on import statement to use qml component from file

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 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 .qrc resource file, and the file exists (project 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?

Edit: I also tried following the steps of this answer with no success.

Adding the content of my .qrc file:

<RCC>
    <qresource prefix="/">
        ...<other not relevant resources>
        <file>../../components/MyComponent.qml</file>
    </qresource>
</RCC>

Screenshot of the warning:

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Adding an alias for the file in your .qrc should resolve the issue, like so:

<file alias="MyComponent.qml">../../components/MyComponent.qml</file>

and then for your import statement simply:

import "qrc:/"

The alias should resolve whatever relative path issue is causing the warning to be thrown by the designer.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda