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\ingroup qmllint-warnings-and-errors
6
7\title Top level component
8\brief [top-level-component] Root QML type is a component.
9
10\qmllintwarningcategory top-level-component
11
12\section1 QML top level type can't be \e Component
13
14\section2 What happened?
15You used the \l [QML] {Component} type as top level type for your
16QML file.
17
18\section2 Why is this bad?
19Your QML file already defines a component by itself. Using a \c Component type as
20a top level type will wrap your component into another unnecessary component.
21
22\section2 Example
23\qml
24import QtQuick
25
26Component {
27 Item { ... }
28}
29\endqml
30To fix this warning, remove the extra Component wrapping:
31\qml
32import QtQuick
33
34Item { ... }
35\endqml
36*/