mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
fixed offset issue with icons in settings list
This commit is contained in:
@@ -44,9 +44,11 @@ void SettingsListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||||||
}
|
}
|
||||||
#endif
|
#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() );
|
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 );
|
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() );
|
QString text = painter->fontMetrics().elidedText( index.data( Qt::DisplayRole ).toString(), Qt::ElideRight, textRect.width() );
|
||||||
|
@@ -58,8 +58,8 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>48</width>
|
<width>32</width>
|
||||||
<height>48</height>
|
<height>32</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="movement">
|
<property name="movement">
|
||||||
|
Reference in New Issue
Block a user