Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
duplicated-name.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-duplicated-name.html
6\ingroup qmllint-warnings-and-errors
7
8\title Duplicated Name
9\brief Multiple signals or properties share the same name in the same Component.
10
11This warning category has multiple warnings:
12\list
13 \li \l{Duplicated Property Name}
14 \li \l{Duplicated Signal Name}
15\endlist
16
17\section1 Duplicated Property Name
18
19\section2 What happened?
20Multiple properties in the same QML component scope have the same name.
21
22\section2 Why is this bad?
23Components with duplicate property names will not be created at runtime: they will be null instead.
24
25\section2 Example
26\qml
27import QtQuick
28
29Item {
30 property int helloWorld
31 property int helloWorld
32}
33\endqml
34You can fix this warning by removing the duplicate property or renaming it:
35\qml
36import QtQuick
37
38Item {
39 property int helloWorld
40}
41\endqml
42
43\section1 Duplicated Signal Name
44
45\section2 What happened?
46Multiple signals in the same QML component scope have the same name.
47
48\section2 Why is this bad?
49Components with duplicate signal names will not be created at runtime: they will be null instead.
50
51\section2 Example
52\qml
53import QtQuick
54
55Rectangle {
56 signal helloWorld
57 signal helloWorld
58}
59\endqml
60You can fix this warning by removing the duplicate signal or renaming it:
61\qml
62import QtQuick
63
64Rectangle {
65 signal helloWorld
66}
67
68\endqml
69*/
70