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
duplicate-enum-entries.qdoc
Go to the documentation of this file.
1// Copyright (C) 2025 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 Duplicate enum entries
8\brief [duplicate-enum-entries] Enum key X has already been declared.
9
10\qmllintwarningcategory duplicate-enum-entries
11
12\section1 Enum key X has already been declared
13
14\section2 What happened?
15An enum contains two identical entries.
16
17\section2 Why is that bad?
18The same key is associated with multiple values. It isn't clear which one will
19be used.
20
21\section2 Example
22\qml
23import QtQuick
24
25Item {
26 enum E { A = 0, B = 1, C = 2, A = 3 }
27}
28\endqml
29To fix this warning, remove or rename duplicate enum entries:
30\qml
31import QtQuick
32
33Item {
34 enum E { A = 0, B = 1, C = 2, D = 3 }
35}
36\endqml
37*/