diff options
| author | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2024-11-28 19:51:11 +0100 |
|---|---|---|
| committer | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2024-12-27 19:52:47 +0100 |
| commit | 422601ba5a25c69ddb3cc1460d346d1f5bcaa6ec (patch) | |
| tree | 9926f0613445fd2fa559ef5aa3f2da234af3b0b4 /src/quick/platform/android/qandroidquickviewembedding.cpp | |
| parent | 7ed50b4ab48881b49f828c98934a075d8706d051 (diff) | |
Fix shrinking issue when binding a Dialogs padding to SafeArea margins
When running the following code:
```
Window {
visible: true
width: 600
height: 600
flags: Qt.ExpandedClientAreaHint | Qt.NoTitleBarBackgroundHint
Dialog {
id: popup
popupType: Popup.Window
topPadding: SafeArea.margins.top
width: 300
height: 300
modal: true
Component.onCompleted: popup.open()
}
}
```
The Dialog would end up with a height of 6 pixels, effectively ignoring
the binding on height, which should have caused the dialog's height to
be 300.
This happened, because the popup item was moved to the popup window
after the popup window's size was set, but before showing the popup
window. When the popup item was moved to the popup window, it would
cause its attached SafeArea object to update, which would cause bindings
that are using safe area margins, to be reevaluated. When binding on a
dialogs padding, the dialogs implicitWidth/implicitHeight would also
need to be reevaluated, due to the default binding that each style is
using. The implicitWidth/implicitHeight should add both the dialogs padding,
and the contentItem's size, in its calculation, however, due to deferred
execution, the contentItem's size is 0 at this point in time, which
causes the binding to evaluate to a really small value.
The popup window listens to changes in the popup's implicitWidth and
implicitHeight, and resizes itself automatically to fit the contentItem's
new geometry. This means the window's initial resize of 300x300, got
overwritten by a much lower value, during all the binding reevaluations
mentioned above, which is catalysted by changing the popup item's parent
to be the popup window's root item.
The issue can be easily fixed by doing the reparenting first, before resizing
the popup window to be popup item's size + insets.
Pick-to: 6.9
Change-Id: I0e2ae69c84c69a49681c4b648790539c5d6da88e
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick/platform/android/qandroidquickviewembedding.cpp')
0 files changed, 0 insertions, 0 deletions
