Unable to see QML Components in non-project folder in Qt Designer

  • I'm working on a project that is importing custom QML Components stored in a directory that is NOT under my project directory.

    My project directory (/home/myHome/ProjectA) contains components that use common base components that are stored in a common directory (/home/myHome/groupFolder/CommonComponents) that other engineers working on different projects can also access. (see attached image)

    quick example of this structure

    • We have added CommonComponents path to my .qmlproject file (i.e.
      importPaths: ["/home/myHome/CommonComponents"] )

    • in /home/myHome/CommonComponents there is a qmldir file that:

    module commoncomponents
    BaseCircle 1.0 BaseCircle.qml
    Angle 1.0 Angle.qml
    Box 1.0 Box.qml

    and I have added import commoncomponents 1.0 at the top of GCircle.qml for example.

    When working in the Qt Creator text editor all works fine. I can get to properties defined in BaseCircle.qml. When I run the application all looks as intended.

    However, if I open Qt Designer I do NOT see BaseCircle on the QMLTypes tab. This, happens automatically if a QML file is in the same directory as the QML file I am editing, or in a directory below it. Is there a way to see those QML components in the QML Types tab in Qt Designer?

  • The designer does not pick up the items from a plugin automatically.
    But you can write a .metainfo file that defines the contents of the item library.

    An example can be found here: https://github.com/qtproject/qt-creator/tree/master/tests/manual/qml/testprojects/plugins.

    Just have a look at: MyPlugin.metainfo

Log in to reply

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