aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <[email protected]>2024-12-13 23:03:25 +0100
committerTor Arne Vestbø <[email protected]>2024-12-19 12:39:38 +0100
commit3a0dc0a93fe354a2ee72bfbb38a1f536bd64bf67 (patch)
tree4660aed8c1be993e6bb5a5871396cf8aea25dac0
parent43083e644174ceea08802127cefcbcc6f8e0e485 (diff)
Take safe areas into account for Qt Quick Controls Drawer
When the drawer is pulled in from the side we want it keep its content away from the non-safe areas, while still drawing the background edge to edge. Pick-to: 6.9 Change-Id: Iff145df719f5746cbdb1d3c13494967c5993c6e6 Reviewed-by: Doris Verria <[email protected]> Reviewed-by: Mitch Curtis <[email protected]>
-rw-r--r--src/quickcontrols/basic/Drawer.qml8
-rw-r--r--src/quickcontrols/fusion/Drawer.qml8
-rw-r--r--src/quickcontrols/imagine/Drawer.qml8
-rw-r--r--src/quickcontrols/ios/Drawer.qml5
-rw-r--r--src/quickcontrols/material/Drawer.qml6
-rw-r--r--src/quickcontrols/universal/Drawer.qml8
6 files changed, 25 insertions, 18 deletions
diff --git a/src/quickcontrols/basic/Drawer.qml b/src/quickcontrols/basic/Drawer.qml
index 8fce061b83..99f1f84a1f 100644
--- a/src/quickcontrols/basic/Drawer.qml
+++ b/src/quickcontrols/basic/Drawer.qml
@@ -15,10 +15,10 @@ T.Drawer {
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
- topPadding: control.edge === Qt.BottomEdge
- leftPadding: control.edge === Qt.RightEdge
- rightPadding: control.edge === Qt.LeftEdge
- bottomPadding: control.edge === Qt.TopEdge
+ topPadding: SafeArea.margins.top + (control.edge === Qt.BottomEdge)
+ leftPadding: SafeArea.margins.left + (control.edge === Qt.RightEdge)
+ rightPadding: SafeArea.margins.right + (control.edge === Qt.LeftEdge)
+ bottomPadding: SafeArea.margins.bottom + (control.edge === Qt.TopEdge)
enter: Transition { SmoothedAnimation { velocity: 5 } }
exit: Transition { SmoothedAnimation { velocity: 5 } }
diff --git a/src/quickcontrols/fusion/Drawer.qml b/src/quickcontrols/fusion/Drawer.qml
index 57fbfcd239..0c70a7dbc6 100644
--- a/src/quickcontrols/fusion/Drawer.qml
+++ b/src/quickcontrols/fusion/Drawer.qml
@@ -17,10 +17,10 @@ T.Drawer {
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
- topPadding: control.edge === Qt.BottomEdge
- leftPadding: control.edge === Qt.RightEdge
- rightPadding: control.edge === Qt.LeftEdge
- bottomPadding: control.edge === Qt.TopEdge
+ topPadding: SafeArea.margins.top + (control.edge === Qt.BottomEdge)
+ leftPadding: SafeArea.margins.left + (control.edge === Qt.RightEdge)
+ rightPadding: SafeArea.margins.right + (control.edge === Qt.LeftEdge)
+ bottomPadding: SafeArea.margins.bottom + (control.edge === Qt.TopEdge)
enter: Transition { SmoothedAnimation { velocity: 5 } }
exit: Transition { SmoothedAnimation { velocity: 5 } }
diff --git a/src/quickcontrols/imagine/Drawer.qml b/src/quickcontrols/imagine/Drawer.qml
index adaf8746d3..e3ec1fcba8 100644
--- a/src/quickcontrols/imagine/Drawer.qml
+++ b/src/quickcontrols/imagine/Drawer.qml
@@ -16,10 +16,10 @@ T.Drawer {
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
- topPadding: background ? background.topPadding : 0
- leftPadding: background ? background.leftPadding : 0
- rightPadding: background ? background.rightPadding : 0
- bottomPadding: background ? background.bottomPadding : 0
+ topPadding: SafeArea.margins.top + (background ? background.topPadding : 0)
+ leftPadding: SafeArea.margins.left + (background ? background.leftPadding : 0)
+ rightPadding: SafeArea.margins.right + (background ? background.rightPadding : 0)
+ bottomPadding: SafeArea.margins.bottom + (background ? background.bottomPadding : 0)
topInset: background ? -background.topInset || 0 : 0
leftInset: background ? -background.leftInset || 0 : 0
diff --git a/src/quickcontrols/ios/Drawer.qml b/src/quickcontrols/ios/Drawer.qml
index 7db1ef51c9..f6b35be43e 100644
--- a/src/quickcontrols/ios/Drawer.qml
+++ b/src/quickcontrols/ios/Drawer.qml
@@ -19,6 +19,11 @@ T.Drawer {
property real inset: control.dim ? 8 : 0
property bool vertical: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge
+ topPadding: SafeArea.margins.top
+ leftPadding: SafeArea.margins.left
+ rightPadding: SafeArea.margins.right
+ bottomPadding: SafeArea.margins.bottom
+
rightInset: background && control.edge === Qt.LeftEdge ? -inset : 0
leftInset: background && control.edge === Qt.RightEdge ? -inset : 0
bottomInset: background && control.edge === Qt.TopEdge ? -inset : 0
diff --git a/src/quickcontrols/material/Drawer.qml b/src/quickcontrols/material/Drawer.qml
index ade48e4d21..9e5cb15956 100644
--- a/src/quickcontrols/material/Drawer.qml
+++ b/src/quickcontrols/material/Drawer.qml
@@ -17,8 +17,10 @@ T.Drawer {
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
- topPadding: edge !== Qt.TopEdge ? Material.roundedScale : 0
- bottomPadding: edge !== Qt.BottomEdge ? Material.roundedScale : 0
+ topPadding: SafeArea.margins.top + (edge !== Qt.TopEdge ? Material.roundedScale : 0)
+ leftPadding: SafeArea.margins.left + (control.edge === Qt.RightEdge)
+ rightPadding: SafeArea.margins.right + (control.edge === Qt.LeftEdge)
+ bottomPadding: SafeArea.margins.bottom + (edge !== Qt.BottomEdge ? Material.roundedScale : 0)
enter: Transition { SmoothedAnimation { velocity: 5 } }
exit: Transition { SmoothedAnimation { velocity: 5 } }
diff --git a/src/quickcontrols/universal/Drawer.qml b/src/quickcontrols/universal/Drawer.qml
index 3216bf06b1..ebf9536dbc 100644
--- a/src/quickcontrols/universal/Drawer.qml
+++ b/src/quickcontrols/universal/Drawer.qml
@@ -15,10 +15,10 @@ T.Drawer {
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
- topPadding: control.edge === Qt.BottomEdge
- leftPadding: control.edge === Qt.RightEdge
- rightPadding: control.edge === Qt.LeftEdge
- bottomPadding: control.edge === Qt.TopEdge
+ topPadding: SafeArea.margins.top + (control.edge === Qt.BottomEdge)
+ leftPadding: SafeArea.margins.left + (control.edge === Qt.RightEdge)
+ rightPadding: SafeArea.margins.right + (control.edge === Qt.LeftEdge)
+ bottomPadding: SafeArea.margins.bottom + (control.edge === Qt.TopEdge)
enter: Transition { SmoothedAnimation { velocity: 5 } }
exit: Transition { SmoothedAnimation { velocity: 5 } }