mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
replaced most of the remaining pixelsizes with pointsizes
This commit is contained in:
@@ -157,43 +157,44 @@ PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
}
|
}
|
||||||
|
|
||||||
QFont figureFont = opt.font;
|
QFont figureFont = opt.font;
|
||||||
figureFont.setPixelSize( 18 );
|
figureFont.setPointSize( 16 );
|
||||||
figureFont.setWeight( 99 );
|
figureFont.setWeight( 99 );
|
||||||
|
|
||||||
QFont boldFont = opt.font;
|
QFont boldFont = opt.font;
|
||||||
boldFont.setPixelSize( 15 );
|
boldFont.setPointSize( 13 );
|
||||||
boldFont.setWeight( 99 );
|
boldFont.setWeight( 99 );
|
||||||
|
|
||||||
QFont smallBoldFont = opt.font;
|
QFont smallBoldFont = opt.font;
|
||||||
smallBoldFont.setPixelSize( 12 );
|
smallBoldFont.setPointSize( 10 );
|
||||||
smallBoldFont.setWeight( 60 );
|
smallBoldFont.setWeight( 60 );
|
||||||
|
|
||||||
QFont durationFont = opt.font;
|
QFont durationFont = opt.font;
|
||||||
durationFont.setPixelSize( 12 );
|
durationFont.setPointSize( 10 );
|
||||||
durationFont.setWeight( 80 );
|
durationFont.setWeight( 80 );
|
||||||
|
QFontMetrics durationFontMetrics( durationFont );
|
||||||
|
|
||||||
if ( index.row() == 0 )
|
if ( index.row() == 0 )
|
||||||
{
|
{
|
||||||
figureFont.setPixelSize( 36 );
|
figureFont.setPointSize( 34 );
|
||||||
boldFont.setPixelSize( 26 );
|
boldFont.setPointSize( 24 );
|
||||||
smallBoldFont.setPixelSize( 22 );
|
smallBoldFont.setPointSize( 20 );
|
||||||
}
|
}
|
||||||
else if ( index.row() == 1 )
|
else if ( index.row() == 1 )
|
||||||
{
|
{
|
||||||
figureFont.setPixelSize( 30 );
|
figureFont.setPointSize( 28 );
|
||||||
boldFont.setPixelSize( 22 );
|
boldFont.setPointSize( 20 );
|
||||||
smallBoldFont.setPixelSize( 18 );
|
smallBoldFont.setPointSize( 16 );
|
||||||
}
|
}
|
||||||
else if ( index.row() == 2 )
|
else if ( index.row() == 2 )
|
||||||
{
|
{
|
||||||
figureFont.setPixelSize( 24 );
|
figureFont.setPointSize( 20 );
|
||||||
boldFont.setPixelSize( 18 );
|
boldFont.setPointSize( 16 );
|
||||||
smallBoldFont.setPixelSize( 14 );
|
smallBoldFont.setPointSize( 12 );
|
||||||
}
|
}
|
||||||
else if ( index.row() >= 10 )
|
else if ( index.row() >= 10 )
|
||||||
{
|
{
|
||||||
boldFont.setPixelSize( 12 );
|
boldFont.setPointSize( 10 );
|
||||||
smallBoldFont.setPixelSize( 11 );
|
smallBoldFont.setPointSize( 9 );
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect figureRect = r.adjusted( 0, 0, -option.rect.width() + 60 - 6 + r.left(), 0 );
|
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 );
|
painter->drawPixmap( pixmapRect, pixmap );
|
||||||
|
|
||||||
r.adjust( pixmapRect.width() + figureRect.width() + 18, 1, -28, 0 );
|
r.adjust( pixmapRect.width() + figureRect.width() + 18, 1, -28, 0 );
|
||||||
QRect leftRect = r.adjusted( 0, 0, -48, 0 );
|
QRect leftRect = r.adjusted( 0, 0, -durationFontMetrics.width( TomahawkUtils::timeToString( duration ) ) - 8, 0 );
|
||||||
QRect rightRect = r.adjusted( r.width() - 40, 0, 0, 0 );
|
|
||||||
|
|
||||||
painter->setFont( boldFont );
|
painter->setFont( boldFont );
|
||||||
QString text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() );
|
QString text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() );
|
||||||
@@ -229,6 +229,7 @@ PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
if ( duration > 0 )
|
if ( duration > 0 )
|
||||||
{
|
{
|
||||||
painter->setFont( durationFont );
|
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() );
|
text = painter->fontMetrics().elidedText( TomahawkUtils::timeToString( duration ), Qt::ElideRight, rightRect.width() );
|
||||||
painter->drawText( rightRect, text, m_centerRightOption );
|
painter->drawText( rightRect, text, m_centerRightOption );
|
||||||
}
|
}
|
||||||
|
@@ -205,20 +205,22 @@ PlaylistLargeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
painter->drawPixmap( avatarRect, avatar );
|
painter->drawPixmap( avatarRect, avatar );
|
||||||
|
|
||||||
QFont boldFont = opt.font;
|
QFont boldFont = opt.font;
|
||||||
boldFont.setPixelSize( 15 );
|
boldFont.setPointSize( 12 );
|
||||||
boldFont.setWeight( 99 );
|
boldFont.setWeight( 99 );
|
||||||
|
QFontMetrics boldFontMetrics( boldFont );
|
||||||
|
|
||||||
QFont smallBoldFont = opt.font;
|
QFont smallBoldFont = opt.font;
|
||||||
smallBoldFont.setPixelSize( 12 );
|
smallBoldFont.setPointSize( 9 );
|
||||||
smallBoldFont.setBold( true );
|
smallBoldFont.setBold( true );
|
||||||
smallBoldFont.setWeight( 60 );
|
smallBoldFont.setWeight( 60 );
|
||||||
|
QFontMetrics smallBoldFontMetrics( smallBoldFont );
|
||||||
|
|
||||||
QFont smallFont = opt.font;
|
QFont smallFont = opt.font;
|
||||||
smallFont.setPixelSize( 10 );
|
smallFont.setPointSize( 8 );
|
||||||
|
|
||||||
r.adjust( pixmapRect.width() + 12, 1, -28 - avatar.width(), 0 );
|
r.adjust( pixmapRect.width() + 12, 1, -28 - avatar.width(), 0 );
|
||||||
QRect leftRect = r.adjusted( 0, 0, -48, 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 );
|
painter->setFont( boldFont );
|
||||||
QString text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() );
|
QString text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() );
|
||||||
@@ -226,7 +228,7 @@ PlaylistLargeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
|
|
||||||
painter->setFont( smallBoldFont );
|
painter->setFont( smallBoldFont );
|
||||||
text = painter->fontMetrics().elidedText( artist, Qt::ElideRight, leftRect.width() );
|
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->setFont( smallFont );
|
||||||
painter->setPen( Qt::gray );
|
painter->setPen( Qt::gray );
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
#include "utils/StyleHelper.h"
|
#include "utils/StyleHelper.h"
|
||||||
#include "utils/TomahawkUtilsGui.h"
|
#include "utils/TomahawkUtilsGui.h"
|
||||||
|
|
||||||
static const int s_defaultFontSize = 12;
|
static const int s_defaultFontSize = 10;
|
||||||
|
|
||||||
|
|
||||||
HeaderLabel::HeaderLabel( QWidget* parent )
|
HeaderLabel::HeaderLabel( QWidget* parent )
|
||||||
@@ -37,10 +37,11 @@ HeaderLabel::HeaderLabel( QWidget* parent )
|
|||||||
{
|
{
|
||||||
QFont f( font() );
|
QFont f( font() );
|
||||||
f.setBold( true );
|
f.setBold( true );
|
||||||
f.setPixelSize( s_defaultFontSize );
|
f.setPointSize( s_defaultFontSize );
|
||||||
|
QFontMetrics fm( f );
|
||||||
|
|
||||||
setFont( f );
|
setFont( f );
|
||||||
setFixedHeight( TomahawkUtils::headerHeight() );
|
setFixedHeight( fm.height() * 1.2 );
|
||||||
setMouseTracking( true );
|
setMouseTracking( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -81,7 +81,7 @@ OverlayButton::setText( const QString& text )
|
|||||||
m_text = text;
|
m_text = text;
|
||||||
|
|
||||||
QFont f( font() );
|
QFont f( font() );
|
||||||
f.setPixelSize( FONT_SIZE );
|
f.setPointSize( FONT_SIZE );
|
||||||
f.setBold( true );
|
f.setBold( true );
|
||||||
|
|
||||||
QFontMetrics fm( f );
|
QFontMetrics fm( f );
|
||||||
|
@@ -104,7 +104,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
|
|||||||
|
|
||||||
QFont f = font();
|
QFont f = font();
|
||||||
f.setBold( true );
|
f.setBold( true );
|
||||||
f.setPixelSize( 18 );
|
f.setPointSize( 15 );
|
||||||
ui->artistLabel->setFont( f );
|
ui->artistLabel->setFont( f );
|
||||||
|
|
||||||
QPalette p = ui->biography->palette();
|
QPalette p = ui->biography->palette();
|
||||||
|
@@ -166,7 +166,6 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
QFont figFont = bold;
|
QFont figFont = bold;
|
||||||
figFont.setFamily( "Arial Bold" );
|
figFont.setFamily( "Arial Bold" );
|
||||||
figFont.setWeight( QFont::Black );
|
figFont.setWeight( QFont::Black );
|
||||||
//figFont.setPixelSize( 10 );
|
|
||||||
figFont.setPointSize( 8 );
|
figFont.setPointSize( 8 );
|
||||||
|
|
||||||
SourceTreeItem* item = index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >();
|
SourceTreeItem* item = index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >();
|
||||||
@@ -302,7 +301,6 @@ SourceDelegate::paintCategory( QPainter* painter, const QStyleOptionViewItem& op
|
|||||||
text = tr( "Hide" );
|
text = tr( "Hide" );
|
||||||
|
|
||||||
QFont font = painter->font();
|
QFont font = painter->font();
|
||||||
//font.setPixelSize( 11 );
|
|
||||||
font.setPointSize( 9 );
|
font.setPointSize( 9 );
|
||||||
font.setBold( true );
|
font.setBold( true );
|
||||||
painter->setFont( font );
|
painter->setFont( font );
|
||||||
@@ -321,7 +319,6 @@ void
|
|||||||
SourceDelegate::paintGroup( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
SourceDelegate::paintGroup( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||||
{
|
{
|
||||||
QFont font = painter->font();
|
QFont font = painter->font();
|
||||||
// font.setPixelSize( 12 );
|
|
||||||
font.setPointSize( 10 );
|
font.setPointSize( 10 );
|
||||||
font.setBold( true );
|
font.setBold( true );
|
||||||
painter->setFont( font );
|
painter->setFont( font );
|
||||||
@@ -368,7 +365,6 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
|||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
QFont font = painter->font();
|
QFont font = painter->font();
|
||||||
// font.setPixelSize( 11 );
|
|
||||||
font.setPointSize( 9 );
|
font.setPointSize( 9 );
|
||||||
painter->setFont( font );
|
painter->setFont( font );
|
||||||
o.font = font;
|
o.font = font;
|
||||||
@@ -468,7 +464,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
|||||||
painter->setPen( pen );
|
painter->setPen( pen );
|
||||||
|
|
||||||
QFont font = painter->font();
|
QFont font = painter->font();
|
||||||
// font.setPixelSize( 12 );
|
|
||||||
font.setPointSize( 10 );
|
font.setPointSize( 10 );
|
||||||
painter->setFont( font );
|
painter->setFont( font );
|
||||||
QFont fontBold = painter->font();
|
QFont fontBold = painter->font();
|
||||||
|
Reference in New Issue
Block a user