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); } }