1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
5\page qmllint-warnings-and-errors-inheritance-cycle.html
6\ingroup qmllint-warnings-and-errors
8\title Inheritance Cycle
9\brief A component inherits from itself.
11\section1 Component Is Part Of An Inheritance Cycle
13\section2 What happened?
14A component inherited directly or indirectly from itself.
16Usually, Components can inherit properties, methods, signals and enums from other components.
18If a component inherits itself directly or indirectly through another base component, then
19it forms an inheritance cycle. The warning indicates that the current component is inside an
20inheritance cycle, see \l{#example}{Example}.
22\section2 Why is this bad?
23Components with inheritance cycles will not be created at runtime: they will be null instead.
30 component Cycle: Cycle {} // not ok: directly inherits from itself
31 component C: C2 {} // not ok: indirectly inherits from itself
35You can fix this warning by breaking up the inheritance cycle
40 component Cycle: Item {} // ok: does not inherit from itself
41 component C: C2 {} // ok: does not indirectly inherits from itself anymore