Bug 513185

Summary: Binding loop detected for property "wideMode" errors for users of Kirigami.FormLayout
Product: [Frameworks and Libraries] frameworks-kirigami Reporter: Nate Graham <nate>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: notmart
Priority: NOR    
Version First Reported In: 6.20.0   
Target Milestone: Not decided   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Nate Graham 2025-12-10 17:57:00 UTC
E.g. opening `systemsettings kcm_powerdevilprofilesconfig` produces the following:

qrc:/kcm/kcm_powerdevilprofilesconfig/main.qml:172:21: QML ProfileConfig: Binding loop detected for property "wideMode":
qrc:/qt/qml/org/kde/kirigami/layouts/FormLayout.qml:72:5
Comment 1 Bug Janitor Service 2025-12-15 16:20:31 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/1995
Comment 2 cwo 2025-12-19 22:29:53 UTC
Git commit f8b4aadf1b79b983fe00b9c5f6dea296b80c6027 by Christoph Wolk.
Committed on 19/12/2025 at 22:25.
Pushed by cwo into branch 'master'.

layouts/FormLayout: avoid binding loop during initial load

FormLayout tracks the implicit width in wide mode in a separate property
and uses this to decide which mode to use. When the implicitWidth
changes, this property is updated with a 0-ms timer, i.e. when the event
loop is clear. This generally prevents a binding loop. But during a
relayout, the update happens immediately, and then can cause a binding
loop, in particular during initialization of the page as at this point
the sizing can widely vary, and the component flips between wide and
narrow mode as contents are added and the available size of the layout
itself is determined. In this case, it may (and usually does) happen
that the component thinks wide mode should be off, some change triggers
a reevluation of the binding, it's changed to on, the
wideModeImplicitWidth is updated and the binding may be reevaluated
again while it's still in the process of finishing up the previous one,
which triggers the binding loop detection.

Instead, we make relayouting also use the timer, rather than immediately
triggering its effect. This avoids the loop. We also trigger it
explicitly in Component.onCompleted as the test (and potentially other
things) expects it to be match after that.

M  +5    -2    src/layouts/FormLayout.qml

https://invent.kde.org/frameworks/kirigami/-/commit/f8b4aadf1b79b983fe00b9c5f6dea296b80c6027