Errores de profundidad de recursión
qmllint denomina esta categoría de advertencia « [recursion-depth-errors] ».
Se ha superado la profundidad máxima de la instrucción o expresión
¿Qué ha pasado?
Una instrucción o expresión QML estaba anidada a una profundidad excesiva para el compilador. Esto suele ocurrir solo en el código generado, donde las instrucciones o expresiones pueden ser muy largas, ya que el límite de recursión suele ser lo suficientemente amplio para cualquier documento QML razonable.
¿Por qué es un problema?
El motor de QML no podrá ejecutar este código.
Ejemplo
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 solucionar esta advertencia, genera automáticamente fragmentos de código más pequeños. Divide los componentes profundamente anidados en varios archivos o componentes en línea, o divide las expresiones profundamente anidadas en varias expresiones:
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.