aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/data/EvilComponentType.qml
diff options
context:
space:
mode:
authorSami Shalayel <sami.shalayel@qt.io>2022-09-26 17:01:40 +0200
committerSami Shalayel <sami.shalayel@qt.io>2022-09-29 18:19:06 +0200
commitd8066adc55051e305e319bfcd7ded7afbd550418 (patch)
treee8f48c133cef2e07232630f23883a07b85833984 /tests/auto/qml/qqmllanguage/data/EvilComponentType.qml
parent4bc3f64b0edc5f097ca7cad4a89a535db67aa266 (diff)
qml: deprecate top-level components
Print a deprecation warning during the IR compilation in the qqmltypecompiler.cpp when a top-level capital-c-Component is found. Also fix all the tests in tst_qqmllanguage that use a top level component (either by wrapping those Components into Items or by removing the explicit redundant Component-wrapping). This implies also fixing the line numbers for Components in tests that got wrapped into an Item. [ChangeLog][QtQml][QQmlComponent] QQmlComponents in qml document roots or in inline component roots are deprecated. Types defined in qml documents or in inline components are automatically wrapped into QQmlComponents when needed: those types really should not be inside a Component{}. Fixes: QTBUG-106547 Change-Id: I00630b879f52f681c98a1d4b804e3505f175b9d6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/data/EvilComponentType.qml')
-rw-r--r--tests/auto/qml/qqmllanguage/data/EvilComponentType.qml6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/EvilComponentType.qml b/tests/auto/qml/qqmllanguage/data/EvilComponentType.qml
new file mode 100644
index 0000000000..04a8503c85
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/EvilComponentType.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.15
+
+Component {
+ id: trulyEvil
+ Item {}
+}