diff --git a/include/TabWidget.h b/include/TabWidget.h index c289f684d..fc7612235 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -30,7 +30,7 @@ #include const int TEXT_TAB_HEIGHT = 14; -const int GRAPHIC_TAB_HEIGHT = 19; +const int GRAPHIC_TAB_HEIGHT = 17; class TabWidget : public QWidget { diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 92c717d35..9172b7e76 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -205,15 +206,13 @@ void TabWidget::resizeEvent( QResizeEvent * ) void TabWidget::paintEvent( QPaintEvent * pe ) { - setFont( pointSize<8>( font() ) ); QPainter p( this ); + p.setFont( pointSize<7>( font() ) ); // Draw background QBrush bg_color = p.background(); p.fillRect( 0, 0, width() - 1, height() - 1, bg_color ); - bool big_tab_captions = ( m_caption == "" ); - // Draw external borders p.setPen( bg_color.color().darker( 150 ) ); p.drawRect( 0, 0, width() - 1, height() - 1 ); @@ -224,6 +223,7 @@ void TabWidget::paintEvent( QPaintEvent * pe ) // Draw title, if any if( ! m_caption.isEmpty() ) { + p.setFont( pointSize<8>( p.font() ) ); p.setPen( tabTitleText() ); p.drawText( 5, 11, m_caption ); } @@ -231,15 +231,6 @@ void TabWidget::paintEvent( QPaintEvent * pe ) // Calculate the tabs' x (tabs are painted next to the caption) int tab_x_offset = m_caption.isEmpty() ? 4 : 14 + fontMetrics().width( m_caption ); - if( big_tab_captions ) - { - p.setFont( pointSize<8>( p.font() ) ); - } - else - { - p.setFont( pointSize<7>( p.font() ) ); - } - // Compute tabs' width depending on the number of tabs (only applicable for artwork tabs) widgetStack::iterator first = m_widgets.begin(); widgetStack::iterator last = m_widgets.end(); @@ -264,15 +255,14 @@ void TabWidget::paintEvent( QPaintEvent * pe ) QPixmap *artwork; if( it.key() == m_activeTab ) { - artwork = new QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ); - p.fillRect( tab_x_offset, 3, ( *it ).nwidth, m_tabbarHeight - 5, tabSelected() ); - } else - { - artwork = new QPixmap( embed::getIconPixmap( ( *it ).inactivePixmap ) ); + artwork = new QPixmap( embed::getIconPixmap( ( *it ).activePixmap ) ); + p.fillRect( tab_x_offset, 0, ( *it ).nwidth, m_tabbarHeight - 1, tabSelected() ); + } else { + artwork = new QPixmap( embed::getIconPixmap( ( *it ).inactivePixmap ) ); } // Draw artwork - p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - ( *artwork ).width() ) / 2, 3, *artwork ); + p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - ( *artwork ).width() ) / 2, 1, *artwork ); } else { // Highlight tab when active @@ -282,7 +272,7 @@ void TabWidget::paintEvent( QPaintEvent * pe ) } // Draw text - p.drawText( tab_x_offset + 3, m_tabheight, ( *it ).name ); + p.drawText( tab_x_offset + 3, m_tabheight + 1, ( *it ).name ); } // Next tab's horizontal position