Question

When I import qml from qrc (which place in different directory from ) it's compile and work fine. But when Qt Creator don't recognize imported component and don't hightlight this.

This's code:

import QtQuick 2.0
import "qrc:/qml_libs/ApplicationContainer"

Item
{
    id: root_object
    width: 300
    height: 200

    ApplicationContainer {
        width : parent.width
        height: parent.height
    }
}
Was it helpful?

Solution

@Aleus, your way of doing thing is little bit tricky. I can't find any information of such kind importing in official documentation (please, take a look at Importing statements in Qt 5.2, QML. Also, take a look at QML Best Practices: Coding Conventions

First of all, check weather your file ApplicationContainer really has no extension (I mean .qml)

To make QtCreator recognize imported component do next things:

  • Add your qml file to .pro file in section OTHER_FILES like this:

    OTHER_FILES += qml_libs/ApplicationContainer

  • AND/OR place statement for importing whole directory to your qml file, like:

    import "qml_libs" as MyLibs ... MyLibs.ApplicationContainer { ... }

Hope it helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top