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
syntax.duplicate-ids.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 Duplicate id
8
\brief [syntax.duplicate-ids] An id is not unique.
9
10
\qmllintwarningcategory syntax.duplicate-ids
11
12
\section1 Found a duplicated id
13
14
\section2 What happened?
15
You used the same value for different \l{qtqml-syntax-objectattributes.html#the-id-attribute}{ids}.
16
17
\section2 Why is this bad?
18
The QML language forbids duplicate ids: they should all be unique in the same QML component.
19
20
\section2 Example
21
\qml
22
import QtQuick
23
24
Item {
25
id: root
26
Item {
27
id: root
28
}
29
}
30
31
\endqml
32
To fix this warning, rename the duplicate to become unique:
33
\qml
34
import QtQuick
35
36
Item {
37
id: root
38
Item {
39
id: notRoot
40
}
41
}
42
43
\endqml
44
*/
qtdeclarative
src
qml
doc
src
qmllint
syntax.duplicate-ids.qdoc
Generated on
for Qt by
1.16.1