このページについて

継承ループ

この警告カテゴリは、qmllint では「[inheritance-cycle] 」と表記されます。

コンポーネントが継承ループの一部となっています

何が起きたのですか?

コンポーネントが、直接または間接的に自分自身から継承されています。

通常、コンポーネントは他のコンポーネントからプロパティ、メソッド、シグナル、および列挙型を継承できます。

コンポーネントが、直接または別の基底コンポーネントを介して間接的に自分自身を継承している場合、継承サイクルが形成されます。この警告は、現在のコンポーネントが継承サイクル内にあることを示しています。例を参照してください。

なぜこれが問題なのでしょうか?

継承ループを含むコンポーネントは、実行時に生成されず、代わりに null となります。

例

import QtQuick

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

この警告を解消するには、継承ループを解消してください:

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{}
}

© 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.