- Qt 6.12
- Qt Qml
- Qt Qml Tooling
- qmllint
- QML Lint Warning and Errors
- Inline component enums
- Qt 6.12.0 Reference Documentation

Inheritance cycle ◦ Invalid qmllint directives

# Inline component enums

This warning category is spelled `[inline-component-enums]` by qmllint.

## Enums declared inside of inline components are ignored

### What happened?

You defined an enum inside an inline component.

### Why is this bad?

The QML language only allows enum definitions inside the root item of the QML file. Enums declared inside an inline component are unusable, even inside the inline component. The same applies to enums declared inside non-root QML objects.

### Example

     import QtQuick

     Item {
         component MyInlineComponent: Item {
             enum MyEnum { Hello, World }
         }
     }

To fix this warning, move the enum declaration into the root element of the QML file:

     import QtQuick

     Item {
         enum MyEnum { Hello, World }
         component MyInlineComponent: Item {
         }
     }

Inheritance cycle ◦ Invalid qmllint directives