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