Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Designer Path Resolving
Qt 6.11 is out! See what's new in the release blog

QML Designer Path Resolving

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 2.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Gendo IkariG Offline
    Gendo IkariG Offline
    Gendo Ikari
    wrote on last edited by
    #1

    I've been working with QML Designer (inside QtCreator) and I found myself into lot of troubles.

    I've a QML C++ plugin in a library project, with lots of QML files loaded into resources, and I have my QML application using the plugin and the qml files, in another project.

    It's surprisingly difficult to setup an environment where QtCreator and Qml Designer both recognize the QMLs from the library. Playing with QML_IMPORT_PATH is not helping very much. QtCreator doesn't recognize the components imported from the library, even if the paths are correct, and QML Designer gives an M300 error, unknown component.

    If I use a relative import path (just as a temporary test), like

    import "path/to/library" 1.0

    instead of

    import Library 1.0

    QtCreator starts to recognize the components (the red underline disappears) QML Designer starts to open the files again without M300, but I have nothing in the QML Types tab (I cannot drag and drop anything from the library).

    What is the correct way to make the QML Designer load and recognize any qml component from any folder, specifying paths? I want to have my components from the library available in the QML Designer ui.

    Thank you.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Thomas Hartmann
      wrote on last edited by
      #2

      Using QML_IMPORT_PATH in the .pro file should work. you have to specify the directory containing the imports e.g. : "path/to".

      To add items to the item library you have to add a .metainfo file to your plugin. You can find an example here:

      https://github.com/qtproject/qt-creator/tree/master/tests/manual/qml/testprojects/plugins/imports/MyPlugin/designer

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved