diff --git a/src/libtomahawk/infobar/InfoBar.cpp b/src/libtomahawk/infobar/InfoBar.cpp index e69e45c59..f2cc48280 100644 --- a/src/libtomahawk/infobar/InfoBar.cpp +++ b/src/libtomahawk/infobar/InfoBar.cpp @@ -44,22 +44,32 @@ InfoBar::InfoBar( QWidget* parent ) , ui( new Ui::InfoBar ) , m_queryLabel( 0 ) { + int requiredHeight = 0; + ui->setupUi( this ); TomahawkUtils::unmarginLayout( layout() ); layout()->setContentsMargins( 8, 4, 8, 4 ); + requiredHeight += 8; // Top + bottom margins QFont boldFont = ui->captionLabel->font(); - boldFont.setPixelSize( 18 ); + //boldFont.setPixelSize( 18 ); + boldFont.setPointSize( 16 ); boldFont.setBold( true ); ui->captionLabel->setFont( boldFont ); ui->captionLabel->setElideMode( Qt::ElideRight ); - boldFont.setPixelSize( 12 ); + QFontMetrics boldFontMetrics( boldFont ); + requiredHeight += boldFontMetrics.height(); + + boldFont.setPointSize( 10 ); boldFont.setBold( false ); ui->descriptionLabel->setFont( boldFont ); + boldFontMetrics = QFontMetrics( boldFont ); + requiredHeight += boldFontMetrics.height(); + QFont regFont = ui->longDescriptionLabel->font(); - regFont.setPixelSize( 11 ); + regFont.setPointSize( 9 ); ui->longDescriptionLabel->setFont( regFont ); m_whitePal = ui->captionLabel->palette(); @@ -70,7 +80,11 @@ InfoBar::InfoBar( QWidget* parent ) ui->longDescriptionLabel->setPalette( m_whitePal ); ui->captionLabel->setMargin( 6 ); + requiredHeight += 2*6; + ui->descriptionLabel->setMargin( 6 ); + requiredHeight += 2*6; + ui->longDescriptionLabel->setMargin( 4 ); ui->captionLabel->setText( QString() ); @@ -95,8 +109,8 @@ InfoBar::InfoBar( QWidget* parent ) setAutoFillBackground( true ); - setMinimumHeight( geometry().height() ); - setMaximumHeight( geometry().height() ); + setMinimumHeight( requiredHeight ); + setMaximumHeight( requiredHeight ); createTile(); diff --git a/src/libtomahawk/infobar/InfoBar.ui b/src/libtomahawk/infobar/InfoBar.ui index de9a45c78..fc754132f 100644 --- a/src/libtomahawk/infobar/InfoBar.ui +++ b/src/libtomahawk/infobar/InfoBar.ui @@ -7,11 +7,11 @@ 0 0 774 - 80 + 72 - + 0 0 @@ -28,9 +28,6 @@ - - QLayout::SetDefaultConstraint - @@ -59,16 +56,13 @@ - - QLayout::SetDefaultConstraint - 0 - + 0 0 @@ -81,7 +75,7 @@ - + 0 0 @@ -104,16 +98,13 @@ 16 - 20 + 0 - - QLayout::SetMaximumSize -