Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86801

Non-modal Drawer blocks shortcuts



    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.14.2, 5.15.0
    • Fix Version/s: None
    • Component/s: Quick: Controls 2
    • Environment:
      tested on Linux, Windows
    • Platform/s:


      Hello everyone,

      I am in Qt 5.15.1, I stumbled on an issue while using the Drawer item. I followed the example "Qt Quick Controls - Side Panel" . The idea is to create a non-modal drawer usable as a fixed side dock when the the width of the window is sufficient.

      Yet, I found out by trials and errors that Shortcut items, "shortcut" properties in Action andr more worrisome (for me) the "Alt+...." shortcuts in the ApplicationWindow.menuBar are unusable. If these are created as children of Drawer, no problem. If the drawer is not "visible", all shortcuts are working. The moment the non-modal drawer is "visible", the parent/ancestors' shortcuts are lost.

      I found a little workaround in adding context: Qt.ApplicationShortcut to Shortcut and coupling each Action with a Shortcut to use this property. Yet, the menuBar is still out of reach of shortcuts.

      I find strange that a non-modal Drawer blocks all its ancestors shortcuts. I know it's inheriting Popup behavior, but it makes using the Side Panel idea difficult.

      Is it a bug ?  Any idea for a workaround ? Do I need to couple all shortcuts from Action or menus with the snippet below :

      Shortcut { 
      sequence: KeySequence.Save 
      context: Qt.ApplicationShortcut 
      onActivated: saveAction.trigger() 


      Here is a working example, switch the visible property of the drawer to see the difference. Type Ctrl+A, Ctrl+B and Alt+F and read the result.


      import QtQuick.Window 2.15
      import QtQuick 2.15
      import QtQml 2.15
      import QtQuick.Controls 2.15
      ApplicationWindow {
          id: base
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")  
          Drawer {
              id: leftDrawer
              parent: base
              visible: true // switch to false 
              width: 200
              height: base.height
              modal: false
              interactive: false
              edge: Qt.LeftEdge 
                  color: "red"
              Action {
                 shortcut: "Ctrl+B"
                 onTriggered: {
          Action {
              shortcut: "Ctrl+A"
              onTriggered: {
      menuBar: MenuBar{       
                   Menu {
                      id: fileMenu
                      title: qsTr("&File")
                          text: "Save"    

      Thank you  !


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            qt.team.quick.subscriptions Qt Quick and Widgets Team
            skrib Cyril Jacquet
            1 Vote for this issue
            2 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes