Inheritance Cycle | Qt QML 6.8.0
Description: A component inherits from itself.

- Qt 6.8
- Qt QML
- QML Lint Warning and Errors
- Inheritance Cycle
- Qt 6.8.0 Reference Documentation

# Inheritance Cycle

## Component Is Part Of An Inheritance Cycle

### What happened?

A component inherited directly or indirectly from itself.

Usually, Components can inherit properties, methods, signals and enums from other components.

If a component inherits itself directly or indirectly through another base component, then it forms an inheritance cycle. The warning indicates that the current component is inside an inheritance cycle, see Example.

### Why is this bad?

Components with inheritance cycles will not be created at runtime: they will be null instead.

### Example

     import QtQuick

     Item {
         component Cycle: Cycle {} // not ok: directly inherits from itself
         component C: C2 {}        // not ok: indirectly inherits from itself
         component C2: C{}
     }

You can fix this warning by breaking up the inheritance cycle

     import QtQuick

     Item {
         component Cycle: Item {}  // ok: does not inherit from itself
         component C: C2 {}        // ok: does not indirectly inherits from itself anymore
         component C2: Cycle{}
     }