diff --git a/data/themes/default/style.css b/data/themes/default/style.css index 3d09e3634..3c306f159 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -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 */ diff --git a/include/TabWidget.h b/include/TabWidget.h index fc7612235..e2239b103 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -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 diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 9172b7e76..bb02d3a29 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -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; +} +