App launcher: keep icon aspect ratio

This commit is contained in:
lupoDharkael
2018-01-18 18:48:34 +01:00
parent 1cc2161299
commit 54c839f673

View File

@@ -45,7 +45,7 @@ void LauncherItemDelegate::paint(
const int halfWidth = rect.width()/2;
const int halfHeight = rect.height()/2;
QSize size(iconSide, iconSide);
QPixmap pixIcon = icon.pixmap(size).scaled(size);
QPixmap pixIcon = icon.pixmap(size).scaled(size, Qt::KeepAspectRatio);
painter->drawPixmap(rect.x() + (halfWidth - halfIcon),
rect.y()+ (halfHeight/2 - halfIcon),
iconSide, iconSide, pixIcon);