aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/doc/snippets/qtquickcontrols-appwindow-safeareas.qml
Commit message (Collapse)AuthorAgeFilesLines
* Teach ApplicationWindow about safe area marginsTor Arne Vestbø2024-12-091-0/+39
If the window has non-safe areas, as reflected by the window's safe area margins, ApplicationWindow will now automatically pad the content item accordingly, ensuring that the content item is within the safe area of the window. To implement this we piggy-back on QQuickControl, letting the control manage the size and position of the content item. This allows us to use the built in padding of QQuickControl to inset the content. Internally the item hierarchy of ApplicationWindow no longer represents the header, footer, and menu bar as children of the ApplicationWindow's content item, but rather as sibling items in the QQuickWindow content item, similar to the window's background item. Doing this is a slight behavior change, but for something that should have been an implementation detail as far as users are concerned. The content control and header, footer and menu bar now all live within the same root QQuickWindow::contentItem, which is a focus scope on its own. End users can override the automatic padding that we do for the contentItem by setting any of the four new padding properties that we expose, mirroring the properties on QQuickControl. [ChangeLog][Important Behavior Changes] The contentItem of ApplicationWindow is now automatically padded to account for safe area margins. To override the automatic padding, set the padding explicitly, via e.g. `topPadding: 0`. Task-number: QTBUG-125373 Change-Id: I986e425a7f316db244c7fc86283b8b333978e3ad Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>