Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
5.13.1
-
-
f15c2c22cb677677ccf8aacb2603fcf774d13584
Description
I'm trying to create a standalone QML extension plugin that publishes QML components that are precompiled in the plugin DLL without exposing QML files.
In plugin DLL pro-file:
Add qml files in resources
use "config += qtquickcompiler"
Include both plugin DLL and qmldir in plugin import directory so there are files
$$QML2_IMPORT_PATH/MyPlugin/myplugin.dll
$$QML2_IMPORT_PATH/MyPlugin/qmldir
Now to the problem. Let's assume qmldir lists the included QML files normally like:
module MyPlugin
plugin myplugin
MyComponent 1.0 MyComponent.qml
Then let's try to import the plugin in an application QML
import MyPlugin 1.0
MyComponent {}
-> This gives error because MyComponent.qml is actually precompiled and located in the resources of myplugin library (qrc:/MyComponent.qml)
Workaround to this is to change plugin's qmldir like this:
module MyPlugin
plugin myplugin
MyComponent 1.0 qrc:/MyComponent.qml
-> This works perfectly otherwise, but starting from Qt 5.13, it gives console error for each included QML component:
"Component "MyComponent" is specified with non-relative URL "qrc:/MyComponent.qml" in a qmldir file. URLs in qmldir files should be relative to the qmldir file's directory."
Everything seems to work still, but clearly these console errors are suggesting that this is a wrong way to do it.
So, is there any working solution now without these console errors for precompiled QML plugins? Or should those console errors be removed?
(Note, documentation of qtquickcompiler actually advices to put also qmldir of the precompiled component in its resources, but in that case case, system does not find the plugin because to load the plugin library's resources containing "qmldir", it should load the plugin first and that cannot be done if "qmldir" is only in its resources.)