qtqmlkeyboard-shortcutsmenubar

Qml MenuItem with Comma in Shortcut


I am writing a Qt 6.5 Qml application with a menubar. It should have "Ctrl+," as a shortcut, but the QML shortcuts are comma delimited. How can I escape the comma to define the shortcut?

import QtQuick
import QtQuick.Window
import Qt.labs.platform

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Example Window")

    MenuBar {
        id: menuBar
        Menu {
            id: mnu
            title: qsTr("Menu")
           
            MenuItem // Next
            {
                id: nextItem
                shortcut: "Ctrl+,"
                text: qsTr("Next")
            }
            MenuItem // Previous
            {
                id: prevItem
                shortcut: "Ctrl+."
                text: qsTr("Previous")
            }
        }
}

Solution

  • At the time of this writing, it was found that the shortcuts DO fire but the shortcut code does not appear in the menu. Qt Support has verified and reproduced this and opened a bug at https://bugreports.qt.io/browse/QTBUG-115642

    It is presently considered an bug in the display but not in the shortcut execution.