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