mirror of
https://github.com/LMMS/lmms.git
synced 2026-05-19 04:06:17 -04:00
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:
@@ -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 & );
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user