Made the TabWidget's title background and borders themeable
This commit is contained in:
@@ -131,6 +131,8 @@ TabWidget {
|
||||
qproperty-tabText: rgb(32, 48, 64);
|
||||
qproperty-tabTitleText: rgb(255, 255, 255);
|
||||
qproperty-tabSelected: rgb(160, 160, 160);
|
||||
qproperty-tabBackground: rgb(60, 67, 75);
|
||||
qproperty-tabBorder: rgb(60, 67, 75);
|
||||
}
|
||||
|
||||
/* main toolbar oscilloscope - can have transparent bg now */
|
||||
|
||||
@@ -54,6 +54,8 @@ public:
|
||||
Q_PROPERTY( QColor tabText READ tabText WRITE setTabText)
|
||||
Q_PROPERTY( QColor tabTitleText READ tabTitleText WRITE setTabTitleText)
|
||||
Q_PROPERTY( QColor tabSelected READ tabSelected WRITE setTabSelected)
|
||||
Q_PROPERTY( QColor tabBackground READ tabBackground WRITE setTabBackground)
|
||||
Q_PROPERTY( QColor tabBorder READ tabBorder WRITE setTabBorder)
|
||||
|
||||
QColor tabText() const;
|
||||
void setTabText( const QColor & c );
|
||||
@@ -61,6 +63,10 @@ public:
|
||||
void setTabTitleText( const QColor & c );
|
||||
QColor tabSelected() const;
|
||||
void setTabSelected( const QColor & c );
|
||||
QColor tabBackground() const;
|
||||
void setTabBackground( const QColor & c );
|
||||
QColor tabBorder() const;
|
||||
void setTabBorder( const QColor & c );
|
||||
|
||||
protected:
|
||||
virtual bool event( QEvent * event );
|
||||
@@ -93,6 +99,8 @@ private:
|
||||
QColor m_tabText; // The color of the tabs' text.
|
||||
QColor m_tabTitleText; // The color of the TabWidget's title text.
|
||||
QColor m_tabSelected; // The highlighting color for the selected tab.
|
||||
QColor m_tabBackground; // The TabWidget's background color.
|
||||
QColor m_tabBorder; // The TabWidget's borders color.
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -42,7 +42,9 @@ TabWidget::TabWidget( const QString & caption, QWidget * parent, bool usePixmap
|
||||
m_usePixmap( usePixmap ),
|
||||
m_tabText( 0, 0, 0 ),
|
||||
m_tabTitleText( 0, 0, 0 ),
|
||||
m_tabSelected( 0, 0, 0 )
|
||||
m_tabSelected( 0, 0, 0 ),
|
||||
m_tabBackground( 0, 0, 0 ),
|
||||
m_tabBorder( 0, 0, 0 )
|
||||
{
|
||||
|
||||
// Create taller tabbar when it's to display artwork tabs
|
||||
@@ -214,11 +216,11 @@ void TabWidget::paintEvent( QPaintEvent * pe )
|
||||
p.fillRect( 0, 0, width() - 1, height() - 1, bg_color );
|
||||
|
||||
// Draw external borders
|
||||
p.setPen( bg_color.color().darker( 150 ) );
|
||||
p.setPen( tabBorder() );
|
||||
p.drawRect( 0, 0, width() - 1, height() - 1 );
|
||||
|
||||
// Draw tabs' bar background
|
||||
p.fillRect( 1, 1, width() - 2, m_tabheight + 2, bg_color.color().darker( 150 ) );
|
||||
p.fillRect( 1, 1, width() - 2, m_tabheight + 2, tabBackground() );
|
||||
|
||||
// Draw title, if any
|
||||
if( ! m_caption.isEmpty() )
|
||||
@@ -339,3 +341,27 @@ void TabWidget::setTabSelected( const QColor & c )
|
||||
m_tabSelected = c;
|
||||
}
|
||||
|
||||
// Return the color to be used for the TabWidget's background
|
||||
QColor TabWidget::tabBackground() const
|
||||
{
|
||||
return m_tabBackground;
|
||||
}
|
||||
|
||||
// Set the color to be used for the TabWidget's background
|
||||
void TabWidget::setTabBackground( const QColor & c )
|
||||
{
|
||||
m_tabBackground = c;
|
||||
}
|
||||
|
||||
// Return the color to be used for the TabWidget's borders
|
||||
QColor TabWidget::tabBorder() const
|
||||
{
|
||||
return m_tabBorder;
|
||||
}
|
||||
|
||||
// Set the color to be used for the TabWidget's borders
|
||||
void TabWidget::setTabBorder( const QColor & c )
|
||||
{
|
||||
m_tabBorder = c;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user