Skip to content

Commit

Permalink
fix #279662: fixup for aeb4919
Browse files Browse the repository at this point in the history
Copying of some selection information is still needed when selection
state can be modified. This commit reverts back to copying Selection
object in such cases.
  • Loading branch information
dmitrio95 committed Dec 9, 2018
1 parent 2435d84 commit a9af205
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libmscore/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ void Score::cmdAddTie(bool addToChord)

void Score::cmdAddOttava(OttavaType type)
{
const Selection& sel = selection();
const Selection sel = selection(); // copy selection state before the operation.
// add on each staff if possible
if (sel.isRange() && sel.staffStart() != sel.staffEnd() - 1) {
for (int staffIdx = sel.staffStart() ; staffIdx < sel.staffEnd(); ++staffIdx) {
Expand Down
2 changes: 1 addition & 1 deletion mscore/palette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ void Palette::applyPaletteElement(PaletteCell* cell, Qt::KeyboardModifiers modif
Score* score = mscore->currentScore();
if (score == 0)
return;
const Selection& sel = score->selection(); // make a copy of the list
const Selection sel = score->selection(); // make a copy of selection state before applying the operation.
if (sel.isNone())
return;

Expand Down
4 changes: 2 additions & 2 deletions mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3330,8 +3330,7 @@ void ScoreView::cmdAddNoteLine()
void ScoreView::cmdChangeEnharmonic(bool both)
{
_score->startCmd();
Selection& selection = _score->selection();
QList<Note*> notes = selection.uniqueNotes();
QList<Note*> notes = _score->selection().uniqueNotes();
for (Note* n : notes) {
Staff* staff = n->staff();
if (staff->part()->instrument()->useDrumset())
Expand Down Expand Up @@ -3392,6 +3391,7 @@ void ScoreView::cmdChangeEnharmonic(bool both)
}
}

Selection& selection = _score->selection();
selection.clear();
for (Note* n : notes)
selection.add(n);
Expand Down

0 comments on commit a9af205

Please sign in to comment.