Merge pull request #2798 from QazCetelic/chronological-screenshot-list

Sort screenshots chronologically in descending order
This commit is contained in:
TheKodeToad 2024-09-10 09:38:11 +01:00 committed by GitHub
commit e3f78e0205
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -242,6 +242,11 @@ ScreenshotsPage::ScreenshotsPage(QString path, QWidget* parent) : QMainWindow(pa
m_model->setReadOnly(false);
m_model->setNameFilters({ "*.png" });
m_model->setNameFilterDisables(false);
// Sorts by modified date instead of creation date because that column is not available and would require subclassing, this should work
// considering screenshots aren't modified after creation.
constexpr int file_modified_column_index = 3;
m_model->sort(file_modified_column_index, Qt::DescendingOrder);
m_folder = path;
m_valid = FS::ensureFolderPathExists(m_folder);