aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc/src/qmllint/duplicated-name.qdoc
blob: 0cc4583cb448c7bc0f29189d48cf5f715e6dd3aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
\page qmllint-warnings-and-errors-duplicated-name.html
\ingroup qmllint-warnings-and-errors

\title Duplicated Name
\brief Multiple signals or properties share the same name in the same Component.

This warning category has multiple warnings:
\list
    \li \l{Duplicated Property Name}
    \li \l{Duplicated Signal Name}
\endlist

\section1 Duplicated Property Name

\section2 What happened?
Multiple properties in the same QML component scope have the same name.

\section2 Why is this bad?
Components with duplicate property names will not be created at runtime: they will be null instead.

\section2 Example
\qml
import QtQuick

Item {
    property int helloWorld
    property int helloWorld
}
\endqml
You can fix this warning by removing the duplicate property or renaming it:
\qml
import QtQuick

Item {
    property int helloWorld
}
\endqml

\section1 Duplicated Signal Name

\section2 What happened?
Multiple signals in the same QML component scope have the same name.

\section2 Why is this bad?
Components with duplicate signal names will not be created at runtime: they will be null instead.

\section2 Example
\qml
import QtQuick

Rectangle {
    signal helloWorld
    signal helloWorld
}
\endqml
You can fix this warning by removing the duplicate signal or renaming it:
\qml
import QtQuick

Rectangle {
    signal helloWorld
}

\endqml
*/