Skip to content

Commit

Permalink
Use portable text to set shortcut
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nino authored and chennes committed Aug 18, 2024
1 parent e3839f1 commit 20549ca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Gui/DlgKeyboardImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,18 +457,18 @@ 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();
}
else {
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);
Expand Down

0 comments on commit 20549ca

Please sign in to comment.