Skip to content
  • Olivier Trichet's avatar
    Fix shortcut not working under non English locale · fd858caf
    Olivier Trichet authored and Nate Graham's avatar Nate Graham committed
    This change wraps calls to QAction::shortcut() done in QML files
    to use the portable representation of QKeySequence.
    
    The QKeySequence to QVariant operator return a string
    representation using the native format not the portable format.
    E.g., the sequence "Space", will be "Espace" under French locale.
    The 'shortcut' attribute of QtQuick Action is stored as QVariant.
    In qml file, when the QAction::shortcut() value (a QKeySequence)
    is affected to a QtQuick Action shortcut, the previous operator is
    used and the shortcut value may be bogus depending on translation.
    
        // A QAction* with the Qt::Key_Space shortcut
        property var playPauseAction: ElisaApplication.action("Play-Pause")
        Action {
            // - playPauseAction.shortcut returns QKeySequence(Qt::Key_Space).
            // - QKeySequence(Qt::Key_Space) is transform into a QVariant that
            //        contains native text "Espace".
            // - this QVariant is affected to shortcut: broken.
            shortcut: playPauseAction.shortcut
            onTriggered: ElisaApplication.audioControl.playPause()
        }
    
    BUG: 424890
    BUG: 410110
    fd858caf