Erros de profundidade de recursão
Essa categoria de aviso é denominada “ [recursion-depth-errors] ” pelo qmllint.
Profundidade máxima de instrução ou expressão excedida
O que aconteceu?
Uma instrução ou expressão QML estava aninhada em um nível muito profundo para o compilador. Isso geralmente ocorre apenas em código gerado, onde as instruções ou expressões podem ser muito longas, já que o limite de recursão costuma ser amplo o suficiente para qualquer documento QML razoável.
Por que isso é ruim?
O mecanismo QML não conseguirá executar esse código.
Exemplo
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
}Para corrigir esse aviso, gere automaticamente trechos de código menores. Divida componentes profundamente aninhados em vários arquivos ou em componentes inline, ou divida expressões profundamente aninhadas em várias expressões:
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 {}
}© 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.