diff --git a/include/PianoRoll.h b/include/PianoRoll.h index eaff75fb8..e4821ab01 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -129,7 +129,7 @@ protected: int width, const Note * n, const QColor & noteCol ); void removeSelection(); void selectAll(); - void getSelectedNotes( NoteVector & selected_notes ); + NoteVector getSelectedNotes(); // for entering values with dblclick in the vol/pan bars void enterValue( NoteVector* nv ); diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 104bbc841..e74e3c602 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3480,20 +3480,21 @@ void PianoRoll::selectAll() // returns vector with pointers to all selected notes -void PianoRoll::getSelectedNotes(NoteVector & selected_notes ) +NoteVector PianoRoll::getSelectedNotes() { - if( ! hasValidPattern() ) - { - return; - } + NoteVector selectedNotes; - for( Note *note : m_pattern->notes() ) + if (hasValidPattern()) { - if( note->selected() ) + for( Note *note : m_pattern->notes() ) { - selected_notes.push_back( note ); + if( note->selected() ) + { + selectedNotes.push_back( note ); + } } } + return selectedNotes; } @@ -3567,8 +3568,7 @@ void PianoRoll::copyToClipboard( const NoteVector & notes ) const void PianoRoll::copySelectedNotes() { - NoteVector selected_notes; - getSelectedNotes( selected_notes ); + NoteVector selected_notes = getSelectedNotes(); if( ! selected_notes.empty() ) { @@ -3586,8 +3586,7 @@ void PianoRoll::cutSelectedNotes() return; } - NoteVector selected_notes; - getSelectedNotes( selected_notes ); + NoteVector selected_notes = getSelectedNotes(); if( ! selected_notes.empty() ) {