Skip to content
Commit fd858caf authored by Olivier Trichet's avatar Olivier Trichet Committed by Nate Graham
Browse files

Fix shortcut not working under non English locale

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
parent d4ba3781
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment