Use portable text to set shortcut

At least on macOS, it seems that setting nontrivial shortcuts only works
when the shortcut is converted to `PortableText`, rather than
`NativeText`.

Before, it was impossible to map, eg, the backspace key or CMD-T to an
action. Now this appears to work.
This commit is contained in:
Nino Annighoefer
2024-08-15 19:23:48 +01:00
committed by Chris Hennes
parent 060912d65c
commit aa40f00f2f

View File

@@ -457,10 +457,10 @@ void DlgCustomKeyboardImp::setShortcutOfCurrentAction(const QString& accelText)
QVariant data = item->data(1, Qt::UserRole);
QByteArray name = data.toByteArray(); // command name
QString nativeText;
QString portableText;
if (!accelText.isEmpty()) {
QKeySequence shortcut = accelText;
nativeText = shortcut.toString(QKeySequence::NativeText);
portableText = shortcut.toString(QKeySequence::PortableText);
ui->accelLineEditShortcut->setText(accelText);
ui->editShortcut->clear();
}
@@ -468,7 +468,7 @@ void DlgCustomKeyboardImp::setShortcutOfCurrentAction(const QString& accelText)
ui->accelLineEditShortcut->clear();
ui->editShortcut->clear();
}
ShortcutManager::instance()->setShortcut(name, nativeText.toLatin1());
ShortcutManager::instance()->setShortcut(name, portableText.toLatin1());
ui->buttonAssign->setEnabled(false);
ui->buttonReset->setEnabled(true);