From d8066adc55051e305e319bfcd7ded7afbd550418 Mon Sep 17 00:00:00 2001 From: Sami Shalayel Date: Mon, 26 Sep 2022 17:01:40 +0200 Subject: 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 --- tests/auto/qml/qqmllanguage/data/ComponentComposite.qml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'tests/auto/qml/qqmllanguage/data/ComponentComposite.qml') diff --git a/tests/auto/qml/qqmllanguage/data/ComponentComposite.qml b/tests/auto/qml/qqmllanguage/data/ComponentComposite.qml index 889450b565..d1c40af3cb 100644 --- a/tests/auto/qml/qqmllanguage/data/ComponentComposite.qml +++ b/tests/auto/qml/qqmllanguage/data/ComponentComposite.qml @@ -1,5 +1,3 @@ import QtQuick 2.0 -Component { - QtObject {} -} +QtObject {} -- cgit v1.2.3