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