Skip to content

Commit

Permalink
fix #101991 Ignore score command shortcuts in menus
Browse files Browse the repository at this point in the history
Previously, certain keyboard shortcuts were active in menus when they
shouldn't be. For example, pressing the letter keys A to G while inside
a menu would cause notes to be added to the score, and S would add a slur.
This was problematic because letter keys are traditionally used to open
menu items (e.g. pressing A in the Help menu should open the About dialog).

This commit prevents unwanted edits from the menus by terminating the edit
operation if the score does not have focus. The shortcut is still active,
however, so this commit DOES NOT restore the traditional behaviour where
pressing letter keys opens menu items. As such, this is a quick fix rather
than a long-term solution. An investigation showed that a better solution
is not possible without significant changes to the shortcut system.

See description in PR #5890 for commentary on various potential ways to solve
this issue that were investigated and rejected in favor of this quick fix.
  • Loading branch information
shoogle committed Apr 15, 2020
1 parent 09aeb75 commit fff6d7f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5879,6 +5879,10 @@ void MuseScore::cmd(QAction* a)
tr("Command %1 not valid in current state").arg(cmdn));
return;
}
if (sc->assignedWidget() == MsWidget::SCORE_TAB && !ctab->isAncestorOf(QApplication::focusWidget())) {
qDebug("MuseScore::cmd(): not on score tab <%s>", qPrintable(cmdn));
return;
}
if (cmdn == "toggle-palette") {
showPalette(a->isChecked());
if (a->isChecked()) {
Expand Down

0 comments on commit fff6d7f

Please sign in to comment.