Draw flat, borderless, semi-transparent and sharp-cornered notes (#2827)

* Draw flat, borderless, semi-transparent and sharp-cornered notes; Increase the contrast of the grid

* Convert the note gradient to a horizontal one

* Increase opacity for better visibility

* Reinstate borders, make the fill semi-transparent

* Some cosmetic touch-ups

* Make border width themeable

* Set a boolean for borderless properties

* Rename borderlessNotes to noteBorders
This commit is contained in:
Umcaruje
2016-06-10 00:00:19 +02:00
committed by GitHub
parent 9eec9a0897
commit 1abbbc2ef6
4 changed files with 72 additions and 57 deletions

View File

@@ -58,13 +58,13 @@ class PianoRoll : public QWidget
Q_PROPERTY( QColor noteModeColor READ noteModeColor WRITE setNoteModeColor )
Q_PROPERTY( QColor noteColor READ noteColor WRITE setNoteColor )
Q_PROPERTY( QColor barColor READ barColor WRITE setBarColor )
Q_PROPERTY( float noteBorderRadiusX READ noteBorderRadiusX WRITE setNoteBorderRadiusX )
Q_PROPERTY( float noteBorderRadiusY READ noteBorderRadiusY WRITE setNoteBorderRadiusY )
Q_PROPERTY( QColor selectedNoteColor READ selectedNoteColor WRITE setSelectedNoteColor )
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
Q_PROPERTY( QColor textColorLight READ textColorLight WRITE setTextColorLight )
Q_PROPERTY( QColor textShadow READ textShadow WRITE setTextShadow )
Q_PROPERTY( QColor markedSemitoneColor READ markedSemitoneColor WRITE setMarkedSemitoneColor )
Q_PROPERTY( int noteOpacity READ noteOpacity WRITE setNoteOpacity )
Q_PROPERTY( bool noteBorders READ noteBorders WRITE setNoteBorders )
public:
enum EditModes
{
@@ -117,10 +117,6 @@ public:
void setNoteColor( const QColor & c );
QColor barColor() const;
void setBarColor( const QColor & c );
float noteBorderRadiusX() const;
void setNoteBorderRadiusX( float b );
float noteBorderRadiusY() const;
void setNoteBorderRadiusY( float b );
QColor selectedNoteColor() const;
void setSelectedNoteColor( const QColor & c );
QColor textColor() const;
@@ -131,6 +127,10 @@ public:
void setTextShadow( const QColor & c );
QColor markedSemitoneColor() const;
void setMarkedSemitoneColor( const QColor & c );
int noteOpacity() const;
void setNoteOpacity( const int i );
bool noteBorders() const;
void setNoteBorders( const bool b );
protected:
@@ -149,7 +149,7 @@ protected:
int getKey( int y ) const;
static void drawNoteRect( QPainter & p, int x, int y,
int width, const Note * n, const QColor & noteCol,
float radiusX, float radiusY, const QColor & selCol );
const QColor & selCol, const int noteOpc, const bool borderless );
void removeSelection();
void selectAll();
NoteVector getSelectedNotes();
@@ -374,13 +374,13 @@ private:
QColor m_noteModeColor;
QColor m_noteColor;
QColor m_barColor;
float m_noteBorderRadiusX;
float m_noteBorderRadiusY;
QColor m_selectedNoteColor;
QColor m_textColor;
QColor m_textColorLight;
QColor m_textShadow;
QColor m_markedSemitoneColor;
int m_noteOpacity;
bool m_noteBorders;
signals:
void positionChanged( const MidiTime & );