From 930aea8b9ca59a24838cf7f279653e3b2ee40cee Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 25 Sep 2017 13:31:11 +0200 Subject: Fix implicit loading of internal types when using explicit imports The QQC Android style has a type that is intended to be internal only and it's loaded implictly (see bug report for details). However the qml file also has to import the module explicitly in order to get access to the singleton the module provides. The documentation says that types of a module are to be specified in the qmldir file, otherwise they are derived from the file name. With commit 22a2cc43387ec3b9f74a6c01f8665378a4541147 that become an exclusive relationship with regards to types from implicit imports. The proposed solution for the JIRA task is to mark the types that are needed internally as "internal" in the qmldir file and fix support for loading internal types through implicit imports (which is what this commit fixes). Task-number: QTBUG-63309 Change-Id: Id696a691f1af1d335c7c8d72f2627064c3d7b9ac Reviewed-by: Michael Brasser Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../qml/qqmllanguage/data/modulewithinternaltypes/MyInternalType.qml | 2 ++ .../qml/qqmllanguage/data/modulewithinternaltypes/MyPublicType.qml | 4 ++++ .../data/modulewithinternaltypes/MyPublicTypeWithExplicitImport.qml | 5 +++++ tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/qmldir | 3 +++ 4 files changed, 14 insertions(+) create mode 100644 tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/MyInternalType.qml create mode 100644 tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/MyPublicType.qml create mode 100644 tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/MyPublicTypeWithExplicitImport.qml create mode 100644 tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/qmldir (limited to 'tests/auto/qml/qqmllanguage/data') diff --git a/tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/MyInternalType.qml b/tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/MyInternalType.qml new file mode 100644 index 0000000000..0e69012662 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/MyInternalType.qml @@ -0,0 +1,2 @@ +import QtQml 2.0 +QtObject {} diff --git a/tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/MyPublicType.qml b/tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/MyPublicType.qml new file mode 100644 index 0000000000..c6b38d51a9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/MyPublicType.qml @@ -0,0 +1,4 @@ +import QtQml 2.0 +QtObject { + property InternalType myInternalType: InternalType {} +} diff --git a/tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/MyPublicTypeWithExplicitImport.qml b/tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/MyPublicTypeWithExplicitImport.qml new file mode 100644 index 0000000000..9b488f92da --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/MyPublicTypeWithExplicitImport.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 +import modulewithinternaltypes 1.0 +QtObject { + property InternalType myInternalType: InternalType {} +} diff --git a/tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/qmldir b/tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/qmldir new file mode 100644 index 0000000000..3593845329 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/modulewithinternaltypes/qmldir @@ -0,0 +1,3 @@ +PublicType 1.0 MyPublicType.qml +PublicTypeWithExplicitImport 1.0 MyPublicTypeWithExplicitImport.qml +internal InternalType MyInternalType.qml -- cgit v1.2.3