Add option to show note values on notes in Piano Roll (#4466)

Add the option to show note values on notes in the Piano Roll. This
functionality is currently coupled with the option "Enable note labels
in piano roll" which can be found in the main menu.

The notes are rendered at about 80% of the notes height. They are only
rendered if they fit on the whole note and if the font does not become
too tiny.

Enable the configuration of the note value text's color via the
stylesheets and set the value to white for both shipped themes.

Other changes:
* Clean up some warnings about old school casts and implicit casts.
This commit is contained in:
Michael Gregorius
2018-07-07 16:50:37 +02:00
parent 1efcec7790
commit 0dc28436fa
4 changed files with 61 additions and 16 deletions

View File

@@ -59,6 +59,7 @@ class PianoRoll : public QWidget
Q_PROPERTY( QColor lineColor READ lineColor WRITE setLineColor )
Q_PROPERTY( QColor noteModeColor READ noteModeColor WRITE setNoteModeColor )
Q_PROPERTY( QColor noteColor READ noteColor WRITE setNoteColor )
Q_PROPERTY( QColor noteTextColor READ noteTextColor WRITE setNoteTextColor )
Q_PROPERTY( QColor barColor READ barColor WRITE setBarColor )
Q_PROPERTY( QColor selectedNoteColor READ selectedNoteColor WRITE setSelectedNoteColor )
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
@@ -122,6 +123,8 @@ public:
void setNoteModeColor( const QColor & c );
QColor noteColor() const;
void setNoteColor( const QColor & c );
QColor noteTextColor() const;
void setNoteTextColor( const QColor & c );
QColor barColor() const;
void setBarColor( const QColor & c );
QColor selectedNoteColor() const;
@@ -157,8 +160,8 @@ protected:
int getKey( int y ) const;
static void drawNoteRect( QPainter & p, int x, int y,
int width, const Note * n, const QColor & noteCol,
const QColor & selCol, const int noteOpc, const bool borderless );
int width, const Note * n, const QColor & noteCol, const QColor & noteTextColor,
const QColor & selCol, const int noteOpc, const bool borderless, bool drawNoteName );
void removeSelection();
void selectAll();
NoteVector getSelectedNotes();
@@ -384,6 +387,7 @@ private:
QColor m_lineColor;
QColor m_noteModeColor;
QColor m_noteColor;
QColor m_noteTextColor;
QColor m_barColor;
QColor m_selectedNoteColor;
QColor m_textColor;