Skip to content

Commit

Permalink
Merge pull request #2543 from luyikei/fix-key-press
Browse files Browse the repository at this point in the history
fix #104881: Arrow up/down and Delete keys stop working in other open scores after piano roll editor is opened in another score
  • Loading branch information
lasconic committed May 20, 2016
2 parents 6776b01 + 9620f09 commit d16c5ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
27 changes: 11 additions & 16 deletions mscore/pianoroll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ PianorollEditor::PianorollEditor(QWidget* parent)
settings.endGroup();
}

QActionGroup* ag = new QActionGroup(this);
ag->addAction(getAction("delete"));
ag->addAction(getAction("pitch-up"));
ag->addAction(getAction("pitch-down"));
ag->addAction(getAction("pitch-up-octave"));
ag->addAction(getAction("pitch-down-octave"));

addActions(ag->actions());
connect(ag, SIGNAL(triggered(QAction*)), SLOT(cmd(QAction*)));
actions.append(getAction("delete"));
actions.append(getAction("pitch-up"));
actions.append(getAction("pitch-down"));
actions.append(getAction("pitch-up-octave"));
actions.append(getAction("pitch-down-octave"));
addActions(actions);
for (auto* action : actions)
connect(action, &QAction::triggered, this, [this, action](bool){ cmd(action); });

setXpos(0);
}

Expand All @@ -225,6 +225,8 @@ PianorollEditor::~PianorollEditor()
{
if (_score)
_score->removeViewer(this);
for (auto* action : actions)
action->disconnect(this);
}

//---------------------------------------------------------
Expand Down Expand Up @@ -512,13 +514,6 @@ void PianorollEditor::moveLocator(int i, const Pos& pos)
void PianorollEditor::cmd(QAction* a)
{
score()->startCmd();

if (a->data() == "delete") {
_score->cmdDeleteSelection();
}
else {
_score->cmd(a);
}
gv->setStaff(staff, locator);
score()->endCmd();
}
Expand Down
1 change: 1 addition & 0 deletions mscore/pianoroll.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class PianorollEditor : public QMainWindow, public MuseScoreView {
QAction* showWave;
WaveView* waveView;
QSplitter* split;
QList<QAction*> actions;

void updateVelocity(Note* note);
void updateSelection();
Expand Down

0 comments on commit d16c5ed

Please sign in to comment.