Solved Creating qml components from data
-
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.
-
Plugins can bundle files in their qrc
-
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?
-
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. -
Plugins can bundle files in their qrc
-
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.