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