継承サイクル

この警告カテゴリーはqmllintによって[inheritance-cycle]

コンポーネントは継承サイクルの一部です

何が起こりましたか?

コンポーネントがそれ自身から直接または間接的に継承しました。

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

コンポーネントが他のベースコンポーネントを介して直接または間接的に自身を継承した場合、そのコンポーネントは継承サイクルを形成します。警告は、現在のコンポーネントが継承サイクルの中にあることを示しています

なぜ悪いのか?

継承サイクルを持つコンポーネントは実行時に生成されません。

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

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