aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/fluentwinui3
diff options
context:
space:
mode:
authorTor Arne Vestbø <[email protected]>2024-12-04 18:53:26 +0100
committerTor Arne Vestbø <[email protected]>2024-12-19 12:39:38 +0100
commit3cdece6d7e08a53774820af6708a16ad3075e9c6 (patch)
treee7f6cd34ca6d5d92a24dc648ee4bcb7d378b1fe7 /src/quickcontrols/fluentwinui3
parent17a3458418e5308584443168495a80afc64b5fab (diff)
Take safe areas into account for Qt Quick Controls ToolBar and MenuBar
A ToolBar and MenuBar is commonly placed in the header/footer/menuBar of an ApplicationWindow, where we don't do any automatic padding to account for the safe area. By adding the safe area margins as padding to the controls, we ensure that the control's background flows into the non-safe area, while the content item of the control (the toolbar or menu bar content) is kept within the safe area. Pick-to: 6.9 Change-Id: I5fad7394beaa01ae8ed142e4e2e42c5bffaab9fa Reviewed-by: Richard Moe Gustavsen <[email protected]>
Diffstat (limited to 'src/quickcontrols/fluentwinui3')
-rw-r--r--src/quickcontrols/fluentwinui3/MenuBar.qml8
-rw-r--r--src/quickcontrols/fluentwinui3/ToolBar.qml8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/quickcontrols/fluentwinui3/MenuBar.qml b/src/quickcontrols/fluentwinui3/MenuBar.qml
index 7487fdb6e2..048d21d5c7 100644
--- a/src/quickcontrols/fluentwinui3/MenuBar.qml
+++ b/src/quickcontrols/fluentwinui3/MenuBar.qml
@@ -15,10 +15,10 @@ T.MenuBar {
spacing: config.spacing || 0
- topPadding: config.topPadding || 0
- bottomPadding: config.bottomPadding || 0
- leftPadding: config.leftPadding || 0
- rightPadding: config.rightPadding || 0
+ topPadding: SafeArea.margins.top + (config.topPadding || 0)
+ bottomPadding: SafeArea.margins.bottom + (config.bottomPadding || 0)
+ leftPadding: SafeArea.margins.left + (config.leftPadding || 0)
+ rightPadding: SafeArea.margins.right + (config.rightPadding || 0)
readonly property var config: Config.controls.toolbar["normal"] || {}
diff --git a/src/quickcontrols/fluentwinui3/ToolBar.qml b/src/quickcontrols/fluentwinui3/ToolBar.qml
index 8c962bb4d9..bb8c5cf47f 100644
--- a/src/quickcontrols/fluentwinui3/ToolBar.qml
+++ b/src/quickcontrols/fluentwinui3/ToolBar.qml
@@ -14,10 +14,10 @@ T.ToolBar {
spacing: config.spacing || 0
- topPadding: config.topPadding || 0
- bottomPadding: config.bottomPadding || 0
- leftPadding: config.leftPadding || 0
- rightPadding: config.rightPadding || 0
+ topPadding: SafeArea.margins.top + (config.topPadding || 0)
+ bottomPadding: SafeArea.margins.bottom + (config.bottomPadding || 0)
+ leftPadding: SafeArea.margins.left + (config.leftPadding || 0)
+ rightPadding: SafeArea.margins.right + (config.rightPadding || 0)
topInset: -config.topInset || 0
bottomInset: -config.bottomInset || 0