Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
top-level-component.qdoc
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\page qmllint-warnings-and-errors-top-level-component.html
6\ingroup qmllint-warnings-and-errors
7
8\title Top level component
9\brief [top-level-component] Root QML type is a component
10
11\qmllintwarningcategory top-level-component
12
13\section1 QML top level type can't be \e Component
14
15\section2 What happened?
16You used the \l [QML] {Component} type as top level type for your
17QML file.
18
19\section2 Why is this bad?
20Your QML file already defines a component by itself. Using a \c Component type as
21a top level type will wrap your component into another unnecessary component.
22
23\section2 Example
24\qml
25import QtQuick
26
27Component {
28 Item { ... }
29}
30\endqml
31To fix this warning, remove the extra Component wrapping:
32\qml
33import QtQuick
34
35Item { ... }
36\endqml
37*/