Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Android SafeArea issue with drawer
Qt 6.11 is out! See what's new in the release blog

Android SafeArea issue with drawer

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 2 Posters 203 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jfurtak
    wrote last edited by jfurtak
    #1

    Hello,
    I am quite new to Qt.
    I know this is quite unorthodox use case, but I wanted to use Drawer as a "toolbox" for my app. I wanted it to slide up from the bottom edge and show additional buttons in my app.
    However, right now, even if buttons are behaving correctly, and are appearing above the Android's navigation bar, the drawer background is rendering under it.

    Is this some kind of a bug or am I doing something wrong?
    I am using Qt 6.11 on Android 16 (Samsung Galaxy Tab A11)

    Drawer{
        id: screenViewButtonsDrawer
        edge: Qt.BottomEdge
        width: parent.width
        height: 65
        modal: false
        interactive: true
        closePolicy: Popup.NoAutoClose
    
        background: Rectangle{
            color: "#cfcfcf"
        }
    
        Button{
            id: buttonChangeView
            anchors {
                left: parent.left
                bottom: parent.bottom
                margins: 10
            }
            text: "Widok"
        }
    
        Button{
            id: buttonSetItemProperties
            anchors {
                right: buttonScreenEdit.left
                bottom: parent.bottom
                margins: 10
            }
            text: "Właściwości"
        }
    
        Button{
            id: buttonScreenEdit
            anchors {
                right: parent.right
                bottom: parent.bottom
                margins: 10
            }
            text: "Edytuj slajd"
        }
    }
    

    Screenshot_20260510_211731.jpg

    Screenshot_20260510_211734.jpg

    1 Reply Last reply
    0
    • ekkescornerE Offline
      ekkescornerE Offline
      ekkescorner
      Qt Champions 2016
      wrote last edited by
      #2

      you should use an ApplicationWindow:

      ApplicationWindow {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
          flags: Qt.Window | Qt.ExpandedClientAreaHint | Qt.NoTitleBarBackgroundHint
      

      and play around with code like this:

              background: Rectangle{
                  color: "red" // "#cfcfcf"
                  anchors.bottom: parent.bottom
                  height: parent.height + SafeArea.margins.bottom
              }
      

      --

              background: Rectangle{
                  color: "red" // "#cfcfcf"
                  anchors.bottom: parent.bottom
                  height: parent.height + SafeArea.margins.bottom  
                  anchors.bottomMargin: SafeArea.margins.bottom
              }
      

      Learn more about edge-to-edge windows and Qt SafeAreas from here or take a look at my test application.

      ekke ... Qt Champion 2016 | 2024 ... mobile business apps

      1 Reply Last reply
      1
      • J Offline
        J Offline
        jfurtak
        wrote last edited by jfurtak
        #3

        Thank you!
        Your application helped me to understand the issue.

        I experimented with your app, and I think that right now, it is impossible to create Drawer sliding from the bottom on Android 16: if I set drawer property

        edge: Qt.BottomEdge
        

        Qt expects me to make sliding gesture from the bottom of the screen which is obstructed by the navigation bar in my case. Also the background represents exactly what Qt is doing - that's why it's broken. I think I can manage to fix the background by doing some

        y: parent.height - height - AppState.safeAreaBottom
        

        etc. but I can never fix that I am not able to open the drawer by myself (without using buttons) anyway. Interestingly, drawer content is aware of the SafeAreas and it avoids displaying under the navigation bar by default.

        Although, it is interesting that Qt does not behave the same way in older Android versions. In Android 9, Drawer works as expected. I think it is due to latest Android's enforcing of edge-to-edge.

        Screenshot_20260512-010702.jpg

        I won't mark this topic as solved, for now. Maybe I am still missing something?

        ekkescornerE 1 Reply Last reply
        0
        • J jfurtak

          Thank you!
          Your application helped me to understand the issue.

          I experimented with your app, and I think that right now, it is impossible to create Drawer sliding from the bottom on Android 16: if I set drawer property

          edge: Qt.BottomEdge
          

          Qt expects me to make sliding gesture from the bottom of the screen which is obstructed by the navigation bar in my case. Also the background represents exactly what Qt is doing - that's why it's broken. I think I can manage to fix the background by doing some

          y: parent.height - height - AppState.safeAreaBottom
          

          etc. but I can never fix that I am not able to open the drawer by myself (without using buttons) anyway. Interestingly, drawer content is aware of the SafeAreas and it avoids displaying under the navigation bar by default.

          Although, it is interesting that Qt does not behave the same way in older Android versions. In Android 9, Drawer works as expected. I think it is due to latest Android's enforcing of edge-to-edge.

          Screenshot_20260512-010702.jpg

          I won't mark this topic as solved, for now. Maybe I am still missing something?

          ekkescornerE Offline
          ekkescornerE Offline
          ekkescorner
          Qt Champions 2016
          wrote last edited by
          #4

          @jfurtak good to hear that my app was helpful.
          ...yep, life isn't easier now with edge-to-edge windows ;-)

          BTW: did a short test on iOS, where you always (in Landscape and Portrait) have a navigation line at bottom. There it's also not possible, to swipe from bottom to open the Drawer.

          if it's important for you to open Drawer from bottom by swiping you should create an Issue at Qt Bugreports with all your screenshots and code. Feel free to mention me there. Would be better to continue discussing there.

          ekke ... Qt Champion 2016 | 2024 ... mobile business apps

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved