git repos / SagoImageBrowser

commit b614a581

Poul Sander · 2026-02-19 21:18
b614a5819a6688d1038a449a7ee56a94cf539f82 patch · browse files
parent 6fcd6c908ee22b0d4a20f8acffe090df2d57e716

Make the images uniform

Changed files

M mainwindow.cpp before
M thumbnailworker.cpp before
diff --git a/mainwindow.cpp b/mainwindow.cpp index fedb644..517f68e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp
@@ -43,9 +43,12 @@ void MainWindow::setupUi()
m_listView->setModel(m_imageModel);
m_listView->setViewMode(QListView::IconMode);
m_listView->setIconSize(QSize(128, 128));
+ m_listView->setGridSize(QSize(148, 168));
m_listView->setResizeMode(QListView::Adjust);
m_listView->setSelectionMode(QAbstractItemView::SingleSelection);
- m_listView->setSpacing(10);
+ m_listView->setSpacing(4);
+ m_listView->setWordWrap(true);
+ m_listView->setTextElideMode(Qt::ElideRight);
// Preview pane (right)
m_previewLabel = new QLabel;
diff --git a/thumbnailworker.cpp b/thumbnailworker.cpp index 25152d5..1ac22d2 100644 --- a/thumbnailworker.cpp +++ b/thumbnailworker.cpp
@@ -26,9 +26,13 @@ void ThumbnailWorker::run()
if (!image.isNull())
{
- QImage thumb = image.scaled(128, 128,
- Qt::KeepAspectRatio,
- Qt::SmoothTransformation);
+ // Scale to cover the 128x128 area, then center-crop
+ QImage scaled = image.scaled(128, 128,
+ Qt::KeepAspectRatioByExpanding,
+ Qt::SmoothTransformation);
+ int x = (scaled.width() - 128) / 2;
+ int y = (scaled.height() - 128) / 2;
+ QImage thumb = scaled.copy(x, y, 128, 128);
emit finished(m_row, thumb);
}
}