エイリアスの循環
この警告カテゴリは、qmllint によって「[alias-cycle] 」と表記されます。
エイリアスプロパティがエイリアスサイクルの一部となっている
何が起きたのか?
プロパティエイリアスが、それ自体、またはそれ自体を解決する別のエイリアスに解決されます。
通常、プロパティエイリアスは、直接的に、あるいは別のエイリアスプロパティを経由して間接的に、別のプロパティを参照する必要があります。
プロパティエイリアスが直接または間接的に自分自身を参照している場合、エイリアスサイクルが形成されます。この警告は、現在のエイリアスプロパティがエイリアスサイクル内にあるか、エイリアスサイクルを参照していることを示しています。例を参照してください。
なぜこれが問題なのでしょうか?
エイリアスサイクルを含むコンポーネントのインスタンスは、実行時に作成されず、代わりに null となります。
例
import QtQuick
Item {
id: someId
property alias myself: someId.myself // not ok: referring to itself
property alias cycle: someId.cycle2 // not ok: indirectly referring to itself
property alias cycle2: someId.cycle
property alias indirect: someId.cycle // not ok: referring to alias indirectly referring to itself
}この警告を解消するには、エイリアスループを解消してください:
import QtQuick
Item {
id: someId
Item {
id: anotherId
property string myself
property int cycle
}
property alias myself: anotherId.myself // ok: referring to a property
property alias cycle: someId.cycle2 // ok: does not refer to itself anymore
property alias cycle2: anotherId.cycle // ok: not a cycle anymore
property alias indirect: someId.cycle // ok: cycle does not form an alias cycle anymore
}© 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.