Recursion depths errors
This warning category is spelled c{[recursion-depth-errors]} by qmllint.
Maximum statement or expression depth exceeded
What happened?
A QML statement or expression was too deeply nested for the compiler. This usually only happens for generated code where statements or expressions can be very long, as the recursion limit is usually large enough for any sensible QML document.
Why is this bad?
The QML engine will not be able to run this code.
Example
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 }
To fix this warning, auto-generate smaller code pieces. Split deeply nested Components in multiple files or inline components, or split deeply nested expressions into multiple expressions:
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 {} }
© 2024 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.