Skip to content

Commit 20549ca

Browse files
ninochennes
authored andcommitted
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.
1 parent e3839f1 commit 20549ca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Gui/DlgKeyboardImp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,18 +457,18 @@ void DlgCustomKeyboardImp::setShortcutOfCurrentAction(const QString& accelText)
457457
QVariant data = item->data(1, Qt::UserRole);
458458
QByteArray name = data.toByteArray(); // command name
459459

460-
QString nativeText;
460+
QString portableText;
461461
if (!accelText.isEmpty()) {
462462
QKeySequence shortcut = accelText;
463-
nativeText = shortcut.toString(QKeySequence::NativeText);
463+
portableText = shortcut.toString(QKeySequence::PortableText);
464464
ui->accelLineEditShortcut->setText(accelText);
465465
ui->editShortcut->clear();
466466
}
467467
else {
468468
ui->accelLineEditShortcut->clear();
469469
ui->editShortcut->clear();
470470
}
471-
ShortcutManager::instance()->setShortcut(name, nativeText.toLatin1());
471+
ShortcutManager::instance()->setShortcut(name, portableText.toLatin1());
472472

473473
ui->buttonAssign->setEnabled(false);
474474
ui->buttonReset->setEnabled(true);

0 commit comments

Comments
 (0)