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. Locally Installed Modules
Qt 6.11 is out! See what's new in the release blog

Locally Installed Modules

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 417 Views 1 Watching
  • 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.
  • imyrvoldI Offline
    imyrvoldI Offline
    imyrvold
    wrote on last edited by
    #1

    I want to use modules in my QtQuick application, but I have problems getting it to work.
    I make a new project, selects Qt Quick Application, and call it TestProject.

    Then I make a new directory in the same directory as the .pro file, calling it "MyComponents".
    Add new files "Comp1.qml" and "Comp2.qml" under the "MyComponents" directory.

    Following the example in http://doc.qt.io/qt-5/qtqml-modules-identifiedmodules.html , I make a new qmldir file in the "MyComponents" directory, with the following content:

    module TestProject.MyComponents 1.0
    Comp1 1.0 Comp1.qml
    Comp2 1.0 Comp2.qml
    

    I also set the QML_IMPORT_PATH in the pro file to the full path to the directory containing my TestProject folder.

    When I now set

    import TestProject.MyComponents 1.0
    

    in the main.qml file, it shows the import line fine without a red underline. But running the project always ends in

    qrc:/main.qml:4 module "TestProject.MyComponents" is not installed
    

    I am wondering what could be wrong, as I followed the instructions in the Qt Documentation.

    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