Fix the shortcuts dialog's implicitWidth binding loop - #72
Open
greenermoose wants to merge 1 commit into
Open
greenermoose wants to merge 1 commit into
greenermoose wants to merge 1 commit into
Conversation
Every launch logged, four times before any dialog was opened: qrc:/Main.qml:327:5: QML Dialog: Binding loop detected for property "implicitWidth": .../QtQuick/Controls/Material/Dialog.qml:14:5 The Ctrl+? shortcuts Dialog assigns a bare Label as its contentItem. Material's Dialog derives implicitWidth from the content item's implicit width, and with a custom content item that value feeds back into the popup's own sizing while the binding is still being evaluated, so QML flags a loop. The dialog rendered correctly regardless, and Qt routes the message to journald rather than stderr when stderr is not a TTY, which is why it was easy to miss. Declare the Label as a child instead, so the default content item owns the sizing. Measured offscreen with Qt 6.11.2 the dialog's implicit size is unchanged (269.6 x 456) and the warnings drop from 2 to 0; wrapping the label in a Column while keeping contentItem does not help, the loop is in the custom-content-item path itself. The new test loads Main.qml, opens the dialog and fails on any "Binding loop detected" message: it fails against the old dialog (2 loops) and passes with this change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every launch of Omawrite 0.5.0 logs this four times, before any dialog is opened:
It comes from the Ctrl+? "Keyboard shortcuts"
Dialog, which assigns a bareLabelas itscontentItem. Material'sDialog.qmlderivesimplicitWidthfrom the content item's implicit width, and with a custom content item that value feeds back into the popup's own sizing while the binding is still being evaluated, so QML flags a loop. The dialog still renders and sizes correctly, which is why it is easy to miss — and Qt routes the message to journald rather than stderr whenever stderr is not a TTY, so piping the output looks clean.Fix: declare the
Labelas a child of theDialoginstead, so the default content item owns the sizing. Measured offscreen with Qt 6.11.2, the dialog's implicit size is identical (269.6 × 456) and the warnings drop from 2 to 0. Wrapping the label in aColumnwhile keepingcontentItem:does not help; the loop is in the custom-content-item path itself. TheobjectNameexists only so the test can find the dialog.Test:
shortcutsDialogHasNoBindingLooploadsMain.qml, opens the dialog, and fails on any "Binding loop detected" message. It fails against the current dialog (2 loops) and passes with this change; the full suite is 13/13.Reproduce on 0.5.0:
🤖 Generated with Claude Code