Skip to content

Commit

Permalink
Fix multiple shortcuts for actions (#571)
Browse files Browse the repository at this point in the history
* Fix multiple shortcuts for actions

* Fix multiple shortcuts (ed.2)
  • Loading branch information
melkorbsd authored Jan 19, 2025
1 parent acad090 commit 282009e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions RedPandaIDE/settingsdialog/environmentshortcutwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void EnvironmentShortcutModel::reload()
else
item->fullPath = QString("%1 > %2").arg(tr("action"),action->text());
item->action = action;
item->shortcut = action->shortcut().toString().trimmed();
item->shortcut = QKeySequence::listToString(action->shortcuts());
item->isAction = true;
mShortcuts.append(item);
}
Expand Down Expand Up @@ -198,7 +198,7 @@ void EnvironmentShortcutModel::loadShortCutsOfMenu(const QMenu *menu, QList<QAct
item->name = action->objectName();
item->fullPath = QString("%1 > %2").arg(menu->title(),action->text());
item->action = action;
item->shortcut = action->shortcut().toString().trimmed();
item->shortcut = QKeySequence::listToString(action->shortcuts());
item->isAction = true;
mShortcuts.append(item);
}
Expand Down
4 changes: 2 additions & 2 deletions RedPandaIDE/shortcutmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ void ShortcutManager::applyTo(QAction *action)
{
PEnvironmentShortcut item = mShortcuts.value(action->objectName(), PEnvironmentShortcut());
if (item && item->isAction) {
action->setShortcut(QKeySequence::fromString(item->shortcut));
action->setShortcuts(QKeySequence::listFromString(item->shortcut));
}
if (!action->shortcut().isEmpty()){
action->setToolTip(action->text()+QString("(%1)").arg(action->shortcut().toString()));
action->setToolTip(action->text()+QString("(%1)").arg(QKeySequence::listToString(action->shortcuts())));
} else {
action->setToolTip(action->text());
}
Expand Down
2 changes: 1 addition & 1 deletion RedPandaIDE/widgets/shortcutinputedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void ShortcutInputEdit::keyPressEvent(QKeyEvent *event)
s = s.mid(0,s.lastIndexOf('+')+1) + event->text().at(0);
}
if (!lastKeys.isEmpty())
s=lastKeys+","+s;
s=lastKeys+"; "+s;
setText(s);
// if (key!=Qt::Key_Tab
// && key!=Qt::Key_Enter
Expand Down

0 comments on commit 282009e

Please sign in to comment.