Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QML files in resources
QtWS25 Last Chance

QML files in resources

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 2 Posters 1.4k 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.
  • J Offline
    J Offline
    jschlich
    wrote on last edited by
    #1

    Hi!

    I have the following problem: I created a qml extension plugin, which I install to a certain place on my system (i.e. I put there a libXXX.so, a qmldir, and a plugins.qmltypes file). The plugin holds some components written in C++, and some pure qml components. Since I do not want my qml files to be public, I added them to my resources (using a .qrc file) and compiled them into the plugin. In addition, I added lines like

    @AnimatedMessageBox 1.0 qrc:///qml/AnimatedMessageBox.qml@

    to my qmldir-file to make the qml stuff available.

    In a test QtQuick-application (running in QtCreator) I can import and use all components from the plugin without problems (after setting the importPaths property correctly). Nevertheless, the pure qml components of the plugin are always marked in red ("unknown component") in QtCreator and their properties are not available. For big components, this is really annoying. The C++ components are displayed properly.

    Any idea how to solve this?

    Thanks a lot!

    P.S.: I tried to put the pure qml components into the plugins.qmltypes file, too, but this seems to make no difference. (Holding the mouse pointer over the import statement for the plugin, I get a message "Read typeinfo files successfully" by the way.)

    P.P.S: I use QtCreator 3.1.0, Qt 5.2.1 on a 64bit Ubuntu 14.04

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

      The code model cannot access the .qml file in the resources.

      The solution is to do the same as Qt does for QtQuick.Controls.
      You have to register the .qml files as composite types using qmlRegisterType() and then use qmlplugindump to create a proper plugins.qmltypes file.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jschlich
        wrote on last edited by
        #3

        Ah, I did not know that I have to register the .qml files, too. I tried qmlplugindump, but of course this did not work without registering...

        Thanks!

        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