Start: fix thumbnails not keeping aspect ratio

This commit is contained in:
Alfredo Monclus
2025-05-29 15:00:37 +02:00
committed by Kacper Donat
parent 9709fc43de
commit 0624d67fe0
+3 -1
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();