From aa40f00f2fbeddac2abc1f0924853cc6c18f15c2 Mon Sep 17 00:00:00 2001 From: Nino Annighoefer Date: Thu, 15 Aug 2024 19:23:48 +0100 Subject: [PATCH] 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. --- src/Gui/DlgKeyboardImp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Gui/DlgKeyboardImp.cpp b/src/Gui/DlgKeyboardImp.cpp index f8adcba5b9..2263814e3f 100644 --- a/src/Gui/DlgKeyboardImp.cpp +++ b/src/Gui/DlgKeyboardImp.cpp @@ -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);