1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 09:04:33 +02:00

fixed font sizes in the context page

This commit is contained in:
Michael Zanetti
2012-07-18 19:36:40 +02:00
parent d44eb51034
commit 53863e9155
3 changed files with 16 additions and 6 deletions

View File

@@ -38,11 +38,12 @@ ContextProxyPage::paint( QPainter* painter, const QStyleOptionGraphicsItem* opti
QFont f( font() ); QFont f( font() );
f.setBold( true ); f.setBold( true );
f.setPixelSize( 14 ); f.setPointSize( 8 );
painter->setFont( f ); painter->setFont( f );
painter->setPen( Qt::white ); painter->setPen( Qt::white );
QRect r( 1, 1, option->rect.width(), 19 ); QFontMetrics fm( f );
QRect r( 1, 1, option->rect.width(), fm.height() * 1.1 );
QTextOption to( Qt::AlignCenter ); QTextOption to( Qt::AlignCenter );
painter->drawText( r, m_page->title(), to ); painter->drawText( r, m_page->title(), to );
@@ -65,8 +66,12 @@ ContextProxyPage::setPage( Tomahawk::ContextPage* page )
} }
#endif #endif
QFont f( font() );
f.setBold( true );
f.setPointSize( 8 );
QFontMetrics fm( f );
QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(); QGraphicsLinearLayout* layout = new QGraphicsLinearLayout();
layout->setContentsMargins( 4, 20, 4, 4 ); layout->setContentsMargins( 4, fm.height() * 1.1, 4, 4 );
layout->addItem( page->widget() ); layout->addItem( page->widget() );
setLayout( layout ); setLayout( layout );

View File

@@ -43,7 +43,6 @@ using namespace Tomahawk;
ContextWidget::ContextWidget( QWidget* parent ) ContextWidget::ContextWidget( QWidget* parent )
: QWidget( parent ) : QWidget( parent )
, ui( new Ui::ContextWidget ) , ui( new Ui::ContextWidget )
, m_minHeight( 22 )
, m_currentView( 0 ) , m_currentView( 0 )
, m_visible( false ) , m_visible( false )
{ {
@@ -86,9 +85,15 @@ ContextWidget::ContextWidget( QWidget* parent )
ui->toggleButton->setPalette( whitePal ); ui->toggleButton->setPalette( whitePal );
QFont boldFont = ui->toggleButton->font(); QFont boldFont = ui->toggleButton->font();
boldFont.setPixelSize( 12 ); //boldFont.setPixelSize( 12 );
boldFont.setPointSize( 10 );
boldFont.setBold( true ); boldFont.setBold( true );
ui->toggleButton->setFont( boldFont ); ui->toggleButton->setFont( boldFont );
QFontMetrics fm( boldFont );
m_minHeight = fm.height() * 1.1;
ui->toggleButton->setMinimumHeight( fm.height() );
setAutoFillBackground( true ); setAutoFillBackground( true );
setFixedHeight( m_minHeight ); setFixedHeight( m_minHeight );

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>774</width> <width>774</width>
<height>72</height> <height>173</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">