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 , imports and library/project organization
Forum Updated to NodeBB v4.3 + New Features

QML , imports and library/project organization

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlqmldirqrcimport
1 Posts 1 Posters 377 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.
  • G Offline
    G Offline
    genner
    wrote on last edited by
    #1

    Hi all,

    I am trying to design a project structure for my future qt/qml codebase.
    My code usually consist of many small/medium size libraries and then I create applications using them. Basically all my code apart some few lines resides in libraries, including application code. I then compile them either statically or dynamically.

    Obviously there are many dependencies, and everything is managed in the .pri and .pro files, with the various INCLUDE_PATH and LIBS variables that point to the proper library dependencies.

    This approach works quite well with standard C++ and also for QWidgets. I am trying to apply the same idea to QML and the cross-platform world, but even after reading the documentation, I am still experiencing issues.
    The idea is to create libraries that both consist of QML and of manager C++ code.

    Just to let you understand better, this is the project structure I have in mind:

    libA
      - source/libA.pri
      - source/libA.pro
      - source/header_files.h
      - source/cpp_files.cpp
      - source/qml/qml_files.qml 
      - source/qml/qmldir
      - source/qml.qrc
    
    // ...
    libN
     - // same structure as libA
    
    App1
     - // same structure as libA
    

    Nothing is fixed, everything can change, but still this should be the basis. What it seems not working are the QML_IMPORT_PATH / QML2_IMPORT_PATH variables . Even if they point to the right path, import directives still do not work: "QML module not found". Apparently the only thing that seems working is the engine.addImportPath("my_paths") approach, fixed in the .cpp files.

    What's your opinion about this approach? is there a way to just use .pri / .pro files to load QML from other libraries?

    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