Start: fix thumbnails not keeping aspect ratio

This commit is contained in:
Alfredo Monclus
2025-05-27 21:49:46 -06:00
committed by Kacper Donat
parent 2438156b23
commit a46dfd3213

View File

@@ -111,7 +111,9 @@ void FileCardDelegate::paint(QPainter* painter,
painter->fontMetrics().lineSpacing() + margin);
// Step 5: Draw
painter->drawPixmap(thumbnailRect, scaledPixmap);
QRect pixmapRect(thumbnailRect.topLeft(), scaledPixmap.size());
pixmapRect.moveCenter(thumbnailRect.center());
painter->drawPixmap(pixmapRect.topLeft(), scaledPixmap);
painter->drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, elidedName);
painter->drawText(sizeRect, Qt::AlignLeft | Qt::AlignTop, size);
painter->restore();