Fix hard-coding of knob and LCDWidget text color

This commit is contained in:
Umcaruje
2016-04-01 23:53:49 +02:00
parent 18365ca8f5
commit f787982d9a
4 changed files with 110 additions and 46 deletions

View File

@@ -65,6 +65,8 @@ class EXPORT Knob : public QWidget, public FloatModelView
mapPropertyFromModel(float,volumeRatio,setVolumeRatio,m_volumeRatio);
Q_PROPERTY(knobTypes knobNum READ knobNum WRITE setknobNum)
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
void initUi( const QString & _name ); //!< to be called by ctors
void onKnobNumUpdated(); //!< to be called when you updated @a m_knobNum
@@ -81,35 +83,38 @@ public:
setDescription( _txt_before );
setUnit( _txt_after );
}
void setLabel( const QString & _txt );
void setLabel( const QString & txt );
void setTotalAngle( float _angle );
void setTotalAngle( float angle );
// Begin styled knob accessors
float innerRadius() const;
void setInnerRadius( float _r );
void setInnerRadius( float r );
float outerRadius() const;
void setOuterRadius( float _r );
void setOuterRadius( float r );
knobTypes knobNum() const;
void setknobNum( knobTypes _k );
void setknobNum( knobTypes k );
QPointF centerPoint() const;
float centerPointX() const;
void setCenterPointX( float _c );
void setCenterPointX( float c );
float centerPointY() const;
void setCenterPointY( float _c );
void setCenterPointY( float c );
float lineWidth() const;
void setLineWidth( float _w );
void setLineWidth( float w );
QColor outerColor() const;
void setOuterColor( const QColor & _c );
void setOuterColor( const QColor & c );
QColor lineColor() const;
void setlineColor( const QColor & _c );
void setlineColor( const QColor & c );
QColor arcColor() const;
void setarcColor( const QColor & _c );
void setarcColor( const QColor & c );
QColor textColor() const;
void setTextColor( const QColor & c );
signals:
@@ -186,6 +191,8 @@ private:
QColor m_outerColor;
QColor m_lineColor; //!< unused yet
QColor m_arcColor; //!< unused yet
QColor m_textColor;
knobTypes m_knobNum;

View File

@@ -34,6 +34,11 @@
class EXPORT LcdWidget : public QWidget
{
Q_OBJECT
// theming qproperties
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
Q_PROPERTY( QColor textShadowColor READ textShadowColor WRITE setTextShadowColor )
public:
LcdWidget( QWidget* parent, const QString& name = QString::null );
LcdWidget( int numDigits, QWidget* parent, const QString& name = QString::null );
@@ -54,13 +59,19 @@ public:
inline int numDigits() const { return m_numDigits; }
inline void setNumDigits( int n ) { m_numDigits = n; updateSize(); }
QColor textColor() const;
void setTextColor( const QColor & c );
QColor textShadowColor() const;
void setTextShadowColor( const QColor & c );
public slots:
virtual void setMarginWidth( int _width );
virtual void setMarginWidth( int width );
protected:
virtual void paintEvent( QPaintEvent * _me );
virtual void paintEvent( QPaintEvent * pe );
virtual void updateSize();
@@ -81,6 +92,9 @@ private:
QString m_label;
QPixmap* m_lcdPixmap;
QColor m_textColor;
QColor m_textShadowColor;
int m_cellWidth;
int m_cellHeight;
int m_numDigits;