From c8954a308948eef48cb638a9648a167d2169e926 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 2 Mar 2020 11:08:20 +1000 Subject: [PATCH] Qt: Fix game list sorting by column --- src/duckstation-qt/gamelistwidget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/duckstation-qt/gamelistwidget.cpp b/src/duckstation-qt/gamelistwidget.cpp index 95126cf0b..a7c71f933 100644 --- a/src/duckstation-qt/gamelistwidget.cpp +++ b/src/duckstation-qt/gamelistwidget.cpp @@ -232,7 +232,7 @@ public: const QVariant left = source_left.data(Qt::InitialSortOrderRole); const QVariant right = source_right.data(Qt::InitialSortOrderRole); if (left != right) - return ascending ? (left < right) : (right < left); + return ascending ? (left < right) : (right > left); // fallback to sorting by title for equal items return m_model->titlesLessThan(source_left.row(), source_right.row(), ascending); @@ -270,6 +270,9 @@ void GameListWidget::initialize(QtHostInterface* host_interface) m_table_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); m_table_view->resizeColumnsToContents(); + // sort by disc type, then title + m_table_sort_model->sort(0, Qt::AscendingOrder); + connect(m_table_view->selectionModel(), &QItemSelectionModel::currentChanged, this, &GameListWidget::onSelectionModelCurrentChanged); connect(m_table_view, &QTableView::doubleClicked, this, &GameListWidget::onTableViewItemDoubleClicked);