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
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 [duplicated-name] Multiple members share the same name in the same component.
10
11\qmllintwarningcategory duplicated-name
12
13\section1 Duplicated property, signal, or method name
14
15\section2 What happened?
16You gave a property, signal or method a name which is already in use in the current
17QML component.
18
19\section2 Why is this bad?
20The QML runtime doesn't create components with duplicate member names at runtime: they
21will be null instead.
22
23\section2 Example
24\qml
25import QtQuick
26
27Item {
28 property int helloWorld
29 property int helloWorld // duplicate property
30 signal helloWorld() // duplicate signal
31}
32\endqml
33To fix this warning, remove or rename the duplicate members:
34\qml
35import QtQuick
36
37Item {
38 property int helloWorld
39 signal helloWorldSignal()
40}
41\endqml
42
43*/