재귀 깊이 오류

이 경고 범주의 철자는 [recursion-depth-errors] 입니다.

최대 문 또는 표현식 깊이를 초과했습니다.

무슨 일이 일어났나요?

QML 문 또는 표현식이 컴파일러에 비해 너무 깊게 중첩되었습니다. 일반적으로 재귀 제한은 일반적으로 합리적인 QML 문서에서 충분히 크므로 문이나 표현식이 매우 길 수 있는 생성된 코드에서만 발생합니다.

이것이 왜 나쁜가요?

QML 엔진이 이 코드를 실행할 수 없기 때문입니다.

예시

import QtQuick

Item {
    function f() {
        let x = 1 + 1 + .... + 1 // maximum depth exceeded: add too many ones together
        return x
    }

    Item { Item { .... } } // maximum depth exceeded: too many nested Item's
}

이 경고를 해결하려면 더 작은 코드 조각을 자동 생성하세요. 깊게 중첩된 컴포넌트를 여러 파일 또는 인라인 컴포넌트로 분할하거나 깊게 중첩된 표현식을 여러 표현식으로 분할합니다:

import QtQuick

Item {
    function f() {
        let x = 1 + 1 + .... + 1 // first half of the split
        x += 1 + 1 + .... + 1 // second half of the split
        return x
    }

    component NestedItem : Item { Item {... }} // first half of the nested Item
    component DeeplyNestedItem: Item { ... NestedItem{} ... } // second half of the nested Items + NestedItem
    DeeplyNestedItem {}
}

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