From 7fbf0d3bf3c3821916119a5303d6bc302f954580 Mon Sep 17 00:00:00 2001 From: QazCetelic Date: Mon, 9 Sep 2024 15:40:31 +0200 Subject: [PATCH] Sort files chronologically in descending order Signed-off-by: Qaz --- launcher/ui/pages/instance/ScreenshotsPage.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/launcher/ui/pages/instance/ScreenshotsPage.cpp b/launcher/ui/pages/instance/ScreenshotsPage.cpp index c3f955733..9c7df9d09 100644 --- a/launcher/ui/pages/instance/ScreenshotsPage.cpp +++ b/launcher/ui/pages/instance/ScreenshotsPage.cpp @@ -242,6 +242,10 @@ 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);