- Qt 6.11
- Qt Qml
- Qt Qml Tooling
- qmllint
- QML Lint Warning and Errors
- Enum entry matches enum
- Qt 6.11.1 Reference Documentation

Duplicated name ◦ Warnings occurred while importing

# Enum entry matches enum

This warning category is spelled `[enum-entry-matches-enum]` by qmllint.

## Enum entry should be named differently than the enum itself

### What happened?

An enum has the same name as one of its entries.

### Why is that bad?

There can be ambiguity as to what a lookup resolves to, see example below.

### Example

     // Main.qml
     import QtQuick

     Item {
         enum E { A, B, C, D, E }
         property var v: Main.E // Does this refer to the enum or to its entry?
     }

To fix this warning, resolve the name clash by renaming either the enum or the enum entry:

     // Main.qml
     import QtQuick

     Item {
         enum Enum { A, B, C, D, E }
         property var v: Main.E // v contains Enum.E. No more ambiguity is possible
     }

Duplicated name ◦ Warnings occurred while importing