How to find the source of a recursive rearrange in QML

2.9k Views Asked by At

I updated my QML application from Qt 5.12 to Qt 5.15.

My application loads its qml sources using the following code:

auto* engine = new QQmlApplicationEngine(this);
...
engine->load(QUrl("qrc:/main.qml"));

When engine->load is called, I now get the following warning, which was not there with Qt 5.12:

Qt Quick Layouts: Detected recursive rearrange. Aborting after two iterations.

How can I find the source of this warning so I can fix my code?

Edit:

After two downvotes, I would like to clarify the intent of my question.

I have a very large application which is loading a big tree of qml files, with main.qml being the main Window. The warning that I posted comes from the Application output pane, without any hint to a source file location that caused the warning.

I am looking for a way to find the source file location that caused this kind of warning. I believe it is reasonable to ask how to achieve that, and I believe that this is a generic problem that will come up for many people who update their qml code to Qt 5.15. It's in the nature of such a issue that a self-contained example (like asked for in the comments) cannot be provided.

1

There are 1 best solutions below

0
On

It's a totally reasonable ask - the warning is ambiguous so you'd have to post the entire codebase to get a minimum viable. Afaik there is no reasonable way to locate the offending bits programmatically but look for Layout components (RowLayout, ColumnLayout, GridLayout) nested inside the same kind of Layout component; these are the usual offenders. For instance:

ColumnLayout {

    ColumnLayout {
        id: childColumnLayout

        // this is generally the cause of your grief
        // changing the the child ColumnLayout to a Column usually fixes it for me

    }
}