별칭 주기

이 경고 카테고리의 철자는 [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
}

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