Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.14.2, 5.15.0, 6.7.0
-
tested on Linux, Windows
Description
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 Rectangle{ color: "red" } Action { shortcut: "Ctrl+B" onTriggered: { console.log("Ctrl+B") } } } Action { shortcut: "Ctrl+A" onTriggered: { console.log("Ctrl+A") } } menuBar: MenuBar{ Menu { id: fileMenu title: qsTr("&File") MenuItem{ text: "Save" } } } }
Thank you !
Edit: Still not working under Qt 6.7, with the imports as :
import QtQuick.Window import QtQuick import QtQml import QtQuick.Controls