doc: add qmllint duplicate id warning
Add description of the warning and an example on how to fix it. Pick-to: 6.7 6.8 Task-number: QTBUG-118112 Change-Id: Iaad5763e2bd69c8703bc0a217c147dd2a14c390c Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
This commit is contained in:
parent
809455f40b
commit
73d7783d58
|
@ -5,22 +5,40 @@
|
|||
\page qmllint-warnings-and-errors-syntax.duplicate-ids.html
|
||||
\ingroup qmllint-warnings-and-errors
|
||||
|
||||
\title syntax.duplicate-ids
|
||||
\brief BRIEF
|
||||
\title Duplicate id
|
||||
\brief An id is not unique.
|
||||
|
||||
\section1 syntax.duplicate-ids
|
||||
\section1 Found a duplicated id
|
||||
|
||||
\section2 What happened?
|
||||
TODO
|
||||
You used the same value for different \l{qtqml-syntax-objectattributes.html#the-id-attribute}{ids}.
|
||||
|
||||
\section2 Why is this bad?
|
||||
TODO
|
||||
The QML language forbids duplicate ids: they should all be unique in the same QML component.
|
||||
|
||||
\section2 Example
|
||||
\qml
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
id: root
|
||||
Item {
|
||||
id: root
|
||||
}
|
||||
}
|
||||
|
||||
\endqml
|
||||
You can fix this warning by TODO
|
||||
To fix this warning, rename the duplicate to become unique:
|
||||
\qml
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
id: root
|
||||
Item {
|
||||
id: notRoot
|
||||
}
|
||||
}
|
||||
|
||||
\endqml
|
||||
*/
|
||||
|
||||
|
|
Loading…
Reference in New Issue