Skip to content

Commit

Permalink
Fix multiple shortcuts (ed.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
melkorbsd committed Jan 18, 2025
1 parent df411a3 commit 02f6ac1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
6 changes: 2 additions & 4 deletions RedPandaIDE/settingsdialog/environmentshortcutwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +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()).replace(';',',');
item->shortcut = QKeySequence::listToString(action->shortcuts());
item->isAction = true;
mShortcuts.append(item);
}
Expand Down Expand Up @@ -199,8 +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()).replace(';',',');
item->shortcut = QKeySequence::listToString(action->shortcuts());
item->isAction = true;
mShortcuts.append(item);
}
Expand Down
9 changes: 2 additions & 7 deletions RedPandaIDE/shortcutmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,10 @@ void ShortcutManager::applyTo(QAction *action)
{
PEnvironmentShortcut item = mShortcuts.value(action->objectName(), PEnvironmentShortcut());
if (item && item->isAction) {
//action->setShortcut(QKeySequence::fromString(item->shortcut));
QStringList SL = item->shortcut.split(',');
QList<QKeySequence> KL;
for (int i=0;i<SL.size();i++) KL.append(QKeySequence::fromString(SL[i]));
action->setShortcuts(KL);
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()).replace(';',',')));
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 02f6ac1

Please sign in to comment.