PianoRoll: fix getKey and remove dead code (#8008)

- Fixes: when right clicking on a piano key close to the lower edge of the screen, "Mark semitone" will mark the wrong key because it uses the upper edge of the context menu as reference.
- Fixes: getKey() is off by 2 pixels
- Introduces: yCoordOfKey() which is the reverse of getKey()
- Removes: section of code that can never be reached

---------

Co-authored-by: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com>
This commit is contained in:
Alex
2025-08-09 21:37:15 +02:00
committed by GitHub
parent ab050b88e5
commit 4dc7784331
2 changed files with 35 additions and 92 deletions

View File

@@ -188,7 +188,6 @@ protected:
void focusOutEvent( QFocusEvent * ) override;
void focusInEvent( QFocusEvent * ) override;
int getKey( int y ) const;
void drawNoteRect( QPainter & p, int x, int y,
int width, const Note * n, const QColor & noteCol, const QColor & noteTextColor,
const QColor & selCol, const int noteOpc, const bool borderless, bool drawNoteName );
@@ -339,6 +338,9 @@ private:
int noteEditRight() const;
int noteEditLeft() const;
int getKey(int y) const;
int yCoordOfKey(int key) const;
void dragNotes(int x, int y, bool alt, bool shift, bool ctrl);
static const int cm_scrollAmtHoriz = 10;