diff options
| author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2025-01-17 13:24:36 +0100 |
|---|---|---|
| committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2025-01-18 21:36:17 +0100 |
| commit | d380dcbe4a18d34ef54b84cb8fda9bfced82523e (patch) | |
| tree | 4f3bd1968bfa63840111886e8bfd60357aefcd1c /src/quick/doc/snippets/qml/safearea | |
| parent | daf3b4a768facc78f791c905d553bc90ee7a91f5 (diff) | |
Make SafeArea.additionalMargins actually add to the margins, not union
The semantics of SafeArea.additionalMargins was initially to union the
additional margins with the inherited margins, as this fit nicely with
the case of adding margins for a header that lives in the non-safe area
of the window.
But for the case of a header that lives within the existing safe area,
but wants to add additional margins for its container's children, the
API was awkward, requiring the user to include the inherited margins
explicitly.
The name additionalMargins was also not correct given these semantics.
We now follow the semantics of addition, which makes the use-case of
a header that lives in the non-safe area a bit more explicit, but also
clearer on exactly how much additional margins is added.
The new semantics also match how AppKit/UIKit handles additional safe
area insets, so the behavior should be familiar to anyone coming from
those platforms.
Pick-to: 6.9
Change-Id: I05e42e68da4237c0c7963457452ffea034ea3ae1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/doc/snippets/qml/safearea')
| -rw-r--r-- | src/quick/doc/snippets/qml/safearea/additional.qml | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/quick/doc/snippets/qml/safearea/additional.qml b/src/quick/doc/snippets/qml/safearea/additional.qml index 900be5819b..dd039313c6 100644 --- a/src/quick/doc/snippets/qml/safearea/additional.qml +++ b/src/quick/doc/snippets/qml/safearea/additional.qml @@ -16,7 +16,7 @@ Rectangle { Rectangle { id: headerItem width: parent.width - height: 80 + parent.SafeArea.margins.top + height: 80 gradient: Gradient.WinterNeva z: 1 } @@ -27,6 +27,7 @@ Rectangle { z: 0 SafeArea.additionalMargins.top: headerItem.height + - parent.SafeArea.margins.top Rectangle { id: childItem |
