Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.5.1, 6.5.2, 6.6.0 Beta2
-
None
-
-
5eaf5afa9 (dev), 181e1080c (6.6), 86e6addc4 (6.5)
Description
In my complex UI (QtQuick), since version 6.5.1 there are reported binding loops for properties having something to do with either height or width. These problems were not present in previous versions of Qt 6 (6.3.1, 6.4.2, 6.5). And to my knowledge, this code is correct and binding loops should not be reported there. It was extremely difficult to extract some sample code, as these problems seem to occur as a result of many factors. Fortunately, I was able to do it for one case:
import QtQuick import QtQuick.Window import QtQuick.Controls import QtQuick.Layouts Window { width: 640 height: 480 visible: true title: qsTr("Hello World") Item { id: mainItem readonly property Component dragItemComponent: Item { id: dragItem readonly property QtObject dragData: dragDataLoader.item readonly property bool isDragActive: true Loader { id: dragDataLoader active: dragItem.isDragActive sourceComponent: QtObject { readonly property string description: "Foo ".repeat(100) } } Loader { id: dragDataDescriptionLoader active: dragItem.isDragActive visible: item !== null sourceComponent: Pane { contentItem: ColumnLayout { Label { Layout.maximumWidth: 100 text: dragItem.dragData ? "%1".arg(dragItem.dragData.description) : "" elide: Label.ElideRight } } background: Rectangle { color: "grey" } } } } Button { text: "Create Drag" onClicked: { mainItem.dragItemComponent.createObject(mainItem, {x: 100, y: 100}); } } } }
The above code reports: QML Pane: Binding loop detected for property "implicitWidth". Which also results in incorrect layouting.
Interestingly, in this particular case there is some workaround of this problem by moving the definition of "dragDataLoader" below the definition of "dragDataDescriptionLoader". So this Bug probably has something in common with the order in which the Bindings are created/evaluated.
In other cases, it is not so trivial. Also, the question is whether this problem applies only to Bindings with size or can also occur in other situations.