diff --git a/src/notation/internal/notationinteraction.cpp b/src/notation/internal/notationinteraction.cpp index 50627b3412eb2..2a96236561858 100644 --- a/src/notation/internal/notationinteraction.cpp +++ b/src/notation/internal/notationinteraction.cpp @@ -194,6 +194,7 @@ NotationInteraction::NotationInteraction(Notation* notation, INotationUndoStackP m_undoStack->undoRedoNotification().onNotify(this, [this]() { endEditElement(); + notifyAboutNoteInputStateChanged(); }); m_undoStack->stackChanged().onNotify(this, [this]() { diff --git a/src/notation/view/percussionpanel/percussionpanelmodel.cpp b/src/notation/view/percussionpanel/percussionpanelmodel.cpp index 7ca2978a90e56..96409efb3fb03 100644 --- a/src/notation/view/percussionpanel/percussionpanelmodel.cpp +++ b/src/notation/view/percussionpanel/percussionpanelmodel.cpp @@ -183,7 +183,6 @@ void PercussionPanelModel::finishEditing(bool discardChanges) return; } - Drumset* updatedDrumset = m_padListModel->drumset(); m_padListModel->removeEmptyRows(); NoteInputState inputState = interaction()->noteInput()->state(); @@ -205,6 +204,8 @@ void PercussionPanelModel::finishEditing(bool discardChanges) return; } + Drumset updatedDrumset = *m_padListModel->drumset(); + for (int i = 0; i < m_padListModel->padList().size(); ++i) { const PercussionPanelPadModel* model = m_padListModel->padList().at(i); if (!model) { @@ -214,7 +215,7 @@ void PercussionPanelModel::finishEditing(bool discardChanges) const int row = i / m_padListModel->numColumns(); const int column = i % m_padListModel->numColumns(); - engraving::DrumInstrument& drum = updatedDrumset->drum(model->pitch()); + engraving::DrumInstrument& drum = updatedDrumset.drum(model->pitch()); drum.panelRow = row; drum.panelColumn = column; @@ -224,8 +225,7 @@ void PercussionPanelModel::finishEditing(bool discardChanges) } // Return if nothing changed after edit... - if (inst->drumset() && updatedDrumset - && *inst->drumset() == *updatedDrumset) { + if (inst->drumset() && *inst->drumset() == updatedDrumset) { setCurrentPanelMode(m_panelModeToRestore); m_padListModel->focusLastActivePad(); return; @@ -234,7 +234,7 @@ void PercussionPanelModel::finishEditing(bool discardChanges) INotationUndoStackPtr undoStack = notation()->undoStack(); undoStack->prepareChanges(muse::TranslatableString("undoableAction", "Edit percussion panel layout")); - score()->undo(new engraving::ChangeDrumset(inst, updatedDrumset, staff->part())); + score()->undo(new engraving::ChangeDrumset(inst, &updatedDrumset, staff->part())); undoStack->commitChanges(); setCurrentPanelMode(m_panelModeToRestore); diff --git a/src/notation/view/percussionpanel/percussionpanelpadlistmodel.h b/src/notation/view/percussionpanel/percussionpanelpadlistmodel.h index ee8d5610534ff..82653d6c717ec 100644 --- a/src/notation/view/percussionpanel/percussionpanelpadlistmodel.h +++ b/src/notation/view/percussionpanel/percussionpanelpadlistmodel.h @@ -73,7 +73,7 @@ class PercussionPanelPadListModel : public QAbstractListModel, public muse::Inje int numPads() const { return m_padModels.count(); } void setDrumset(const engraving::Drumset* drumset); - engraving::Drumset* drumset() const { return m_drumset; } + const engraving::Drumset* drumset() const { return m_drumset; } QList padList() const { return m_padModels; }