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. Organising a QML project with a plugin and an app
QtWS25 Last Chance

Organising a QML project with a plugin and an app

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlpluginprojectorganization
1 Posts 1 Posters 791 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.
  • A Offline
    A Offline
    Acristal
    wrote on 8 Sept 2016, 18:09 last edited by Acristal 9 Aug 2016, 18:37
    #1

    Hi guys!

    I had a question about the organisation of my project with QML (I use Qt 5.3.2).

    I have a set of standard/generic controls that I want to use to build an actual application.
    What I wanted to do is to have a specific QML plugin with all my controls, and then use that plugin on my application.
    Does that make sense? I have a hard time finding out ways of organising a QML project online.

    So I tried to implement this system, and I end up with this: my main project is a template subdirs project. It has 2 children: app and controls.
    controls is the QML plugin (template lib), and app is the application itself (template app).
    In the controls project, I have a qmldir file to register my plugin and my QML files. All the resources of my plugin (QML files and icons) are in the QRC of controls. The install step only copy the dynamic library (which I think should contain the QRC) and the qmldir. I used a QRC because I'd really like to only have a dynamic library and not have to publish all the QML sources.
    In the app project, I also have a QRC with the actual views of my application. This project has no direct link with the controls project, since the latter generated a dynamic library.
    The entire thing look like this:

    root/
    |
    +-- root.pro
    |
    +-- app/
    |   |
    |   +-- app.pro
    |   |
    |   +-- app.qrc/
    |       |
    |       +-- main.qml
    |
    +-- controls/
        |
        +-- controls.pro
        |
        +-- qmldir
        |
        +-- controls.qrc/
            |
            +-- QML + icons...
    

    When I run my application, I specify the QML2_IMPORT_PATH to the path where I installed the controls plugin so that I can import my.plugin.controls 1.0 in my views.
    But, the issue is that, although my application find the plugin, it can not load the QML elements because the files are not found.
    I tried to use Q_INIT_RESOURCE(controls) in the app, but it doesn't work either. I always end up with my QML files being not found.
    How can I fix that? Is this an idiomatic way of organising a QML project in the first place?

    Thanks a lot!

    1 Reply Last reply
    0

    1/1

    8 Sept 2016, 18:09

    • Login

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