Loading QML from a plugin's QRC

  • I have a Qml application that hosts Qml components that are contained in plugins (dll/so/dynlib) which contain QML resources.

    I want to be able to ask the plugin for the QUrl to the qml code it would like the application to display and I wanted to know how will my app know to resolve the Url in the plugin rather than its own resources built into the application.

    For example, if my application has a main.qml and the person who wrote the plugin has a main.qml built into their plugin - how can I point the QUrl towards the plugin's resources rather than the hosting application's?


    component.loadUrl( QUrl( QStringLiteral( "qrc:/MyComponent.qml" ) ) );

    How would my application code indicate to the ::loadUrl() method that it should look in the plugin to resolve that Url?

    Does everything get glommed together into one big resource table and I need to introduce a naming schema such as "qrc:/myplugin.MyComponent.qml"?

    Worst case I presume the plugin could just read the qml like a string and pass that along, but that makes organizing the qml code on the plugin side more complicated.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.