再帰深度エラー
この警告カテゴリーはqmllintによって[recursion-depth-errors]
。
文または式の最大深度を超えました
何が起こりましたか?
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.