Enum key case | Qt Qml | Qt 6.12.0
Description: [enum-key-case] Enum key starts with a lowercase letter

- Qt 6.12
- Qt Qml
- Qt Qml Tooling
- qmllint
- QML Lint Warning and Errors
- Enum key case
- Qt 6.12.0 Reference Documentation

Enum entry matches enum ◦ Warnings occurred while importing

# Enum key case

This warning category is spelled `[enum-key-case]` by qmllint.

## Enum key starts with a lowercase letter

### What happened?

An enum contains a key starting with a lowercase letter.

### Why is that bad?

It can create ambiguity when performing lookups. Enum keys should start with an uppercase letter to distinguish them from properties of singletons and attached objects. Not following this convention can lead to unexpected results.

### Example

     // Properties.qml
     import QtQuick

     Item {
         enum Color { red, green, blue }
     }

     // Main.qml
     import QtQuick

     Item {
         // This lookup could be interpreted as a property lookup on a Singleton or attached object.
         property int i: Properties.green
     }

To fix this warning, rename the key so it starts with an uppercase letter.

     // Properties.qml
     import QtQuick

     Item {
         enum Color { Red, Green, Blue }
     }

     // Main.qml
     import QtQuick

     Item {
         // No ambiguity for the user or the QML engine, this is an enum lookup.
         property int i: Properties.Green
     }

Enum entry matches enum ◦ Warnings occurred while importing