Vererbungszyklus
Diese Warnkategorie wird von qmllint als „ [inheritance-cycle] “ bezeichnet.
Die Komponente ist Teil eines Vererbungszyklus
Was ist passiert?
Eine Komponente erbt direkt oder indirekt von sich selbst.
Normalerweise können Komponenten Eigenschaften, Methoden, Signale und Enums von anderen Komponenten erben.
Wenn eine Komponente direkt oder indirekt über eine andere Basiskomponente von sich selbst erbt, entsteht ein Vererbungszyklus. Die Warnung weist darauf hin, dass sich die aktuelle Komponente in einem Vererbungszyklus befindet, siehe Beispiel.
Warum ist das problematisch?
Komponenten mit Vererbungszyklen werden zur Laufzeit nicht erstellt: Stattdessen sind sie null.
Beispiel
import QtQuick
Item {
component Cycle: Cycle {} // not ok: directly inherits from itself
component C: C2 {} // not ok: indirectly inherits from itself
component C2: C{}
}Um diese Warnung zu beheben, unterbrechen Sie den Vererbungskreislauf:
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.