diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-03-01 10:11:18 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-03-04 23:35:39 +0100 |
commit | ce52c245aaccf3183ef4759882e25b51b539195a (patch) | |
tree | 5229da9fac5299d95671e551bd2e513942b71d02 /tests/auto/qml/qqmldirparser/data | |
parent | 3881f0df3d115ba8e59a5cedea970f3b085aa84a (diff) |
Add a "prefer" directive to qmldir
The argument is the path from which further files from the module should
be loaded. This allows us to load potentially pre-compiled files
from a resource contained in a plugin. The qmldir file has to be stored
outside the plugin in order for the QML engine to find it, but the QML
files can now be stored inside the plugin.
[ChangeLog][QtQml] You can now specify that QML files in a QML module
should be loaded from a different place than the directory where the
qmldir file is found. To do this, add a "prefer" directive to the qmldir
file. The most useful application of this is adding the QML files as
resources to a plugin, and using qmlcachegen to pre-compile them. You
can then add their path inside the resource file system as "prefer"
path in order to make the engine load the pre-compiled files. The plain
files should still be installed next to the qmldir file so that they
remain visible to tooling.
Change-Id: Ib281b39230621b3762432095a47fb499412cbaa6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmldirparser/data')
-rw-r--r-- | tests/auto/qml/qqmldirparser/data/prefer-no-slash/qmldir | 5 | ||||
-rw-r--r-- | tests/auto/qml/qqmldirparser/data/prefer/qmldir | 5 | ||||
-rw-r--r-- | tests/auto/qml/qqmldirparser/data/two-prefer/qmldir | 6 |
3 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmldirparser/data/prefer-no-slash/qmldir b/tests/auto/qml/qqmldirparser/data/prefer-no-slash/qmldir new file mode 100644 index 0000000000..3ad24eed20 --- /dev/null +++ b/tests/auto/qml/qqmldirparser/data/prefer-no-slash/qmldir @@ -0,0 +1,5 @@ +module FooBar +classname FooBarInstance +prefer :/foo/bar +plugin doesnotexist +Foo 1.0 Foo.qml diff --git a/tests/auto/qml/qqmldirparser/data/prefer/qmldir b/tests/auto/qml/qqmldirparser/data/prefer/qmldir new file mode 100644 index 0000000000..06cb227c43 --- /dev/null +++ b/tests/auto/qml/qqmldirparser/data/prefer/qmldir @@ -0,0 +1,5 @@ +module FooBar +classname FooBarInstance +prefer :/foo/bar/ +plugin doesnotexist +Foo 1.0 Foo.qml diff --git a/tests/auto/qml/qqmldirparser/data/two-prefer/qmldir b/tests/auto/qml/qqmldirparser/data/two-prefer/qmldir new file mode 100644 index 0000000000..08a5ca6834 --- /dev/null +++ b/tests/auto/qml/qqmldirparser/data/two-prefer/qmldir @@ -0,0 +1,6 @@ +module FooBar +classname FooBarInstance +prefer :/foo/bar/ +prefer :/wrong/wrong/ +plugin doesnotexist +Foo 1.0 Foo.qml |