1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-19 23:41:51 +02:00

fixed offset issue with icons in settings list

This commit is contained in:
Michael Zanetti 2011-08-14 22:37:55 +02:00
parent a887232fff
commit f2e76803cc
2 changed files with 6 additions and 4 deletions

View File

@ -44,9 +44,11 @@ void SettingsListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
}
#endif
QRect iconRect = option.rect.adjusted( 23, 6, -option.rect.width() + option.decorationSize.width() + 7, -option.rect.height() + option.decorationSize.height() + 2 - 12 );
int horizontalOffset = ( option.rect.width() - option.decorationSize.width() ) /2;
QRect iconRect = option.rect.adjusted( horizontalOffset, 6, -horizontalOffset, -option.rect.height() + 6 + option.decorationSize.height() );
QPixmap avatar = index.data( Qt::DecorationRole ).value<QIcon>().pixmap( iconRect.size() );
painter->drawPixmap( iconRect, avatar.scaledToHeight( iconRect.height(), Qt::SmoothTransformation ) );
painter->drawPixmap( iconRect, avatar );
QRect textRect = option.rect.adjusted( 6, iconRect.height() + 8, -6, 0 );
QString text = painter->fontMetrics().elidedText( index.data( Qt::DisplayRole ).toString(), Qt::ElideRight, textRect.width() );

View File

@ -58,8 +58,8 @@
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="movement">