QML-Designer and external Components

  • The problem I have is, that the qml designer not found my reusable components. This components lie in a separate directory named MwComponents and there is a qmldir file.

    To use this components in an application I create a resource file with this components and add the import statement.


    Now I can import this components using

    @import MwComponents 1.0 as MWC@

    and it works. The Texteditor can resolve the components, I think the reason is the variable in the .pro file

    @QML_IMPORT_PATH += "$${MW_ROOT_PATH}/src/hmi/MwQml/qml"@

    But the designer will not show the components.


  • Hi, this will not work. I have set the variable in the .pro file and as environment variable.
    Where shows the QML-Designer this new components? QML-components section show the qml-files from the same directory.

  • Did you try QML2_IMPORT_PATH in environment? Not QML_IMPORT_PATH.

    For the pro file, try full path for QML_IMPORT_PATH first, instead of using MW_ROOT_PATH. Eg:
    QML_IMPORT_PATH += "/home/foo/src/hmi/MwQml/qml"

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.