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. Creating qml components from data
Forum Updated to NodeBB v4.3 + New Features

Creating qml components from data

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 3 Posters 334 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.
  • M Offline
    M Offline
    Markus Fauster
    wrote on last edited by
    #1

    Hi all,

    I need to create qml components from data that is dynamically provided by using QQmlComponent::setData. Referenced types seem to be searched based on the url, which does not succeed because none of these files exist in an accessible path.

    Therefore I would need a way to allow QQmlEngine to access my "virtual file system" or register the source for all available components beforehand.

    I think QQmlEnginePrivate::typeLoader could be used for this purpose, but I would prefer a public and clean way similar to how ImageProviders work.

    Does anyone have a hint on how to approach this?

    Thanks.

    1 Reply Last reply
    0
    • GrecKoG Offline
      GrecKoG Offline
      GrecKo
      Qt Champions 2018
      wrote on last edited by
      #4

      Plugins can bundle files in their qrc

      1 Reply Last reply
      1
      • fcarneyF Offline
        fcarneyF Offline
        fcarney
        wrote on last edited by
        #2

        What do you mean by "data"? What exactly are you trying to do? Are you trying to create components from generated QML source? Or create components with property data? Where is the data going to come from?

        C++ is a perfectly valid school of magic.

        1 Reply Last reply
        1
        • M Offline
          M Offline
          Markus Fauster
          wrote on last edited by
          #3

          I want to allow plugins (based on our own plugin framework) to extend our applications qml gui.
          My current plan is to upload a package containing the qml resources (all qml files and images) and tell the application which item should be created for which area of the ui.
          These items are managed in a dedicated qml engine (for sandboxing), and the necessary objects for application & plugin interaction are provided in the context.
          This seems to work so far, but I would like to avoid having to store the content on a physical drive.

          1 Reply Last reply
          1
          • GrecKoG Offline
            GrecKoG Offline
            GrecKo
            Qt Champions 2018
            wrote on last edited by
            #4

            Plugins can bundle files in their qrc

            1 Reply Last reply
            1
            • M Offline
              M Offline
              Markus Fauster
              wrote on last edited by
              #5

              Thanks, this is a great hint!
              Since these are not qt plugins this cannot happen automatically, but I just discovered the QResource::registerResource method that should work for my requirements.
              I will mark this thread as solved as soon as I have a working prototype.

              1 Reply Last reply
              1

              • Login

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