Select the correct piano key for marking semitones (#5478)

When selecting a Piano Key to mark semitones in the Piano Roll we
select key from the y position of the pop-up menu and not the mouse.
Incidentally these two are most often the same as the menu builds
from the mouse y positon and down. If there is room for it. If there
is no room downward it will create the menu so the lower part of the
frame aligns with the mouse y position.
Fixed by creating a variable to hold the pressed key before creating
the menu.
This commit is contained in:
Oskar Wallgren
2020-05-02 09:41:44 +02:00
committed by GitHub
parent 687870d302
commit ca09b29087
2 changed files with 3 additions and 1 deletions

View File

@@ -250,6 +250,7 @@ private:
QList<int> m_markedSemiTones;
QMenu * m_semiToneMarkerMenu; // when you right click on the key area
int m_pianoKeySelected;
PianoRoll();
PianoRoll( const PianoRoll & );

View File

@@ -507,7 +507,7 @@ void PianoRoll::changeNoteEditMode( int i )
void PianoRoll::markSemiTone( int i )
{
const int key = getKey( mapFromGlobal( m_semiToneMarkerMenu->pos() ).y() );
const int key = m_pianoKeySelected;
const InstrumentFunctionNoteStacking::Chord * chord = nullptr;
switch( static_cast<SemiToneMarkerAction>( i ) )
@@ -1704,6 +1704,7 @@ void PianoRoll::mousePressEvent(QMouseEvent * me )
if( me->buttons() == Qt::RightButton )
{
// right click, tone marker contextual menu
m_pianoKeySelected = getKey( me->y() );
m_semiToneMarkerMenu->popup( mapToGlobal( QPoint( me->x(), me->y() ) ) );
}
else