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
duplicate-inline-components.qdoc
Go to the documentation of this file.
1// Copyright (C) 2025 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 Duplicate inline components
8\brief [duplicate-inline-components] Duplicate inline component.
9
10\qmllintwarningcategory duplicate-inline-component
11
12\section1 Duplicate inline component
13
14\section2 What happened?
15Two inline components have the same name.
16
17\section2 Why is that bad?
18One name refers to more than one type and causes an ambiguity. This will fail
19to compile.
20
21\section2 Example
22\qml
23import QtQuick
24
25Item {
26 component R : Rectangle { color: "red" }
27 component R : Rectangle { color: "blue" } // Fail to compile
28}
29\endqml
30To fix this warning, remove or rename one of the inline components:
31\qml
32import QtQuick
33
34Item {
35 component RedRectangle : Rectangle { color: "red" }
36 component BlueRectangle : Rectangle { color: "blue" }
37}
38\endqml
39*/