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

replaced most of the remaining pixelsizes with pointsizes

This commit is contained in:
Michael Zanetti 2012-07-18 22:34:55 +02:00
parent a62b09076c
commit 33007cb05e
6 changed files with 32 additions and 32 deletions

View File

@ -157,43 +157,44 @@ PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
}
QFont figureFont = opt.font;
figureFont.setPixelSize( 18 );
figureFont.setPointSize( 16 );
figureFont.setWeight( 99 );
QFont boldFont = opt.font;
boldFont.setPixelSize( 15 );
boldFont.setPointSize( 13 );
boldFont.setWeight( 99 );
QFont smallBoldFont = opt.font;
smallBoldFont.setPixelSize( 12 );
smallBoldFont.setPointSize( 10 );
smallBoldFont.setWeight( 60 );
QFont durationFont = opt.font;
durationFont.setPixelSize( 12 );
durationFont.setPointSize( 10 );
durationFont.setWeight( 80 );
QFontMetrics durationFontMetrics( durationFont );
if ( index.row() == 0 )
{
figureFont.setPixelSize( 36 );
boldFont.setPixelSize( 26 );
smallBoldFont.setPixelSize( 22 );
figureFont.setPointSize( 34 );
boldFont.setPointSize( 24 );
smallBoldFont.setPointSize( 20 );
}
else if ( index.row() == 1 )
{
figureFont.setPixelSize( 30 );
boldFont.setPixelSize( 22 );
smallBoldFont.setPixelSize( 18 );
figureFont.setPointSize( 28 );
boldFont.setPointSize( 20 );
smallBoldFont.setPointSize( 16 );
}
else if ( index.row() == 2 )
{
figureFont.setPixelSize( 24 );
boldFont.setPixelSize( 18 );
smallBoldFont.setPixelSize( 14 );
figureFont.setPointSize( 20 );
boldFont.setPointSize( 16 );
smallBoldFont.setPointSize( 12 );
}
else if ( index.row() >= 10 )
{
boldFont.setPixelSize( 12 );
smallBoldFont.setPixelSize( 11 );
boldFont.setPointSize( 10 );
smallBoldFont.setPointSize( 9 );
}
QRect figureRect = r.adjusted( 0, 0, -option.rect.width() + 60 - 6 + r.left(), 0 );
@ -215,8 +216,7 @@ PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
painter->drawPixmap( pixmapRect, pixmap );
r.adjust( pixmapRect.width() + figureRect.width() + 18, 1, -28, 0 );
QRect leftRect = r.adjusted( 0, 0, -48, 0 );
QRect rightRect = r.adjusted( r.width() - 40, 0, 0, 0 );
QRect leftRect = r.adjusted( 0, 0, -durationFontMetrics.width( TomahawkUtils::timeToString( duration ) ) - 8, 0 );
painter->setFont( boldFont );
QString text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() );
@ -229,6 +229,7 @@ PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
if ( duration > 0 )
{
painter->setFont( durationFont );
QRect rightRect = r.adjusted( r.width() - durationFontMetrics.width( TomahawkUtils::timeToString( duration ) ), 0, 0, 0 );
text = painter->fontMetrics().elidedText( TomahawkUtils::timeToString( duration ), Qt::ElideRight, rightRect.width() );
painter->drawText( rightRect, text, m_centerRightOption );
}

View File

@ -205,20 +205,22 @@ PlaylistLargeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
painter->drawPixmap( avatarRect, avatar );
QFont boldFont = opt.font;
boldFont.setPixelSize( 15 );
boldFont.setPointSize( 12 );
boldFont.setWeight( 99 );
QFontMetrics boldFontMetrics( boldFont );
QFont smallBoldFont = opt.font;
smallBoldFont.setPixelSize( 12 );
smallBoldFont.setPointSize( 9 );
smallBoldFont.setBold( true );
smallBoldFont.setWeight( 60 );
QFontMetrics smallBoldFontMetrics( smallBoldFont );
QFont smallFont = opt.font;
smallFont.setPixelSize( 10 );
smallFont.setPointSize( 8 );
r.adjust( pixmapRect.width() + 12, 1, -28 - avatar.width(), 0 );
QRect leftRect = r.adjusted( 0, 0, -48, 0 );
QRect rightRect = r.adjusted( r.width() - 40, 0, 0, 0 );
QRect rightRect = r.adjusted( r.width() - smallBoldFontMetrics.width( TomahawkUtils::timeToString( duration ) ), 0, 0, 0 );
painter->setFont( boldFont );
QString text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() );
@ -226,7 +228,7 @@ PlaylistLargeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
painter->setFont( smallBoldFont );
text = painter->fontMetrics().elidedText( artist, Qt::ElideRight, leftRect.width() );
painter->drawText( leftRect.adjusted( 0, 19, 0, 0 ), text, m_topOption );
painter->drawText( leftRect.adjusted( 0, boldFontMetrics.height(), 0, 0 ), text, m_topOption );
painter->setFont( smallFont );
painter->setPen( Qt::gray );

View File

@ -26,7 +26,7 @@
#include "utils/StyleHelper.h"
#include "utils/TomahawkUtilsGui.h"
static const int s_defaultFontSize = 12;
static const int s_defaultFontSize = 10;
HeaderLabel::HeaderLabel( QWidget* parent )
@ -37,10 +37,11 @@ HeaderLabel::HeaderLabel( QWidget* parent )
{
QFont f( font() );
f.setBold( true );
f.setPixelSize( s_defaultFontSize );
f.setPointSize( s_defaultFontSize );
QFontMetrics fm( f );
setFont( f );
setFixedHeight( TomahawkUtils::headerHeight() );
setFixedHeight( fm.height() * 1.2 );
setMouseTracking( true );
}

View File

@ -81,7 +81,7 @@ OverlayButton::setText( const QString& text )
m_text = text;
QFont f( font() );
f.setPixelSize( FONT_SIZE );
f.setPointSize( FONT_SIZE );
f.setBold( true );
QFontMetrics fm( f );

View File

@ -104,7 +104,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
QFont f = font();
f.setBold( true );
f.setPixelSize( 18 );
f.setPointSize( 15 );
ui->artistLabel->setFont( f );
QPalette p = ui->biography->palette();

View File

@ -166,7 +166,6 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
QFont figFont = bold;
figFont.setFamily( "Arial Bold" );
figFont.setWeight( QFont::Black );
//figFont.setPixelSize( 10 );
figFont.setPointSize( 8 );
SourceTreeItem* item = index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >();
@ -302,7 +301,6 @@ SourceDelegate::paintCategory( QPainter* painter, const QStyleOptionViewItem& op
text = tr( "Hide" );
QFont font = painter->font();
//font.setPixelSize( 11 );
font.setPointSize( 9 );
font.setBold( true );
painter->setFont( font );
@ -321,7 +319,6 @@ void
SourceDelegate::paintGroup( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
QFont font = painter->font();
// font.setPixelSize( 12 );
font.setPointSize( 10 );
font.setBold( true );
painter->setFont( font );
@ -368,7 +365,6 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
painter->save();
QFont font = painter->font();
// font.setPixelSize( 11 );
font.setPointSize( 9 );
painter->setFont( font );
o.font = font;
@ -468,7 +464,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
painter->setPen( pen );
QFont font = painter->font();
// font.setPixelSize( 12 );
font.setPointSize( 10 );
painter->setFont( font );
QFont fontBold = painter->font();