Track: make the song editor background CSS-stylable with qproperties

This commit is contained in:
Vesa
2014-04-05 14:55:11 +03:00
parent bd691e6d68
commit 3bcffcdf5b
3 changed files with 122 additions and 7 deletions

View File

@@ -29,6 +29,7 @@
#include <QtCore/QVector>
#include <QtCore/QList>
#include <QtGui/QWidget>
#include <QColor>
#include "lmms_basics.h"
#include "MidiTime.h"
@@ -236,6 +237,18 @@ private:
class trackContentWidget : public QWidget, public JournallingObject
{
Q_OBJECT
// qproperties for track background gradients
Q_PROPERTY( QColor darkerColor1 READ darkerColor1 WRITE setDarkerColor1 )
Q_PROPERTY( QColor darkerColor2 READ darkerColor2 WRITE setDarkerColor2 )
Q_PROPERTY( QColor darkerColor3 READ darkerColor3 WRITE setDarkerColor3 )
Q_PROPERTY( QColor lighterColor1 READ lighterColor1 WRITE setLighterColor1 )
Q_PROPERTY( QColor lighterColor2 READ lighterColor2 WRITE setLighterColor2 )
Q_PROPERTY( QColor lighterColor3 READ lighterColor3 WRITE setLighterColor3 )
Q_PROPERTY( float gradMidPoint READ gradMidPoint WRITE setGradMidPoint )
public:
trackContentWidget( trackView * _parent );
virtual ~trackContentWidget();
@@ -255,6 +268,28 @@ public:
MidiTime endPosition( const MidiTime & _pos_start );
// qproperty access methods
QColor darkerColor1() const;
QColor darkerColor2() const;
QColor darkerColor3() const;
QColor lighterColor1() const;
QColor lighterColor2() const;
QColor lighterColor3() const;
float gradMidPoint() const;
void setDarkerColor1( const QColor & _c );
void setDarkerColor2( const QColor & _c );
void setDarkerColor3( const QColor & _c );
void setLighterColor1( const QColor & _c );
void setLighterColor2( const QColor & _c );
void setLighterColor3( const QColor & _c );
void setGradMidPoint( float _g );
public slots:
void update();
void changePosition( const MidiTime & _new_pos = MidiTime( -1 ) );
@@ -295,6 +330,14 @@ private:
QPixmap m_background;
// qproperty fields
QColor * m_darkerColor1;
QColor * m_darkerColor2;
QColor * m_darkerColor3;
QColor * m_lighterColor1;
QColor * m_lighterColor2;
QColor * m_lighterColor3;
float m_gradMidPoint;
} ;