[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [palapeli] src/file-io: Sort List by piece count does not work
From:       Christian Ehrlicher <null () kde ! org>
Date:       2017-08-31 18:20:27
Message-ID: E1dnU4p-0002y9-GX () code ! kde ! org
[Download RAW message or body]

Git commit 2a78d0bd8b5a8a3b326046231edab1570c21176b by Christian Ehrlicher.
Committed on 31/08/2017 at 18:08.
Pushed by chehrlic into branch 'master'.

Sort List by piece count does not work

Summary:
The sorting in the overview dialog did not work because the
QSortFilterProxyModel was not set up correctly

BUG: 376607

Test Plan:
Test if the sorting works by selecting the appropriate sorting

Reviewers: #kde_games, ltoscano

Reviewed By: ltoscano

Subscribers: ltoscano, #kde_games

Differential Revision: https://phabricator.kde.org/D7578

M  +5    -2    src/file-io/collection-view.cpp

https://commits.kde.org/palapeli/2a78d0bd8b5a8a3b326046231edab1570c21176b

diff --git a/src/file-io/collection-view.cpp b/src/file-io/collection-view.cpp
index d45b310..a1428d1 100644
--- a/src/file-io/collection-view.cpp
+++ b/src/file-io/collection-view.cpp
@@ -57,7 +57,10 @@ Palapeli::CollectionView::CollectionView(QWidget* parent)
 	m_view->setModel(m_proxyModel);
 	connect(m_view->selectionModel(), \
SIGNAL(selectionChanged(QItemSelection,QItemSelection)), \
SLOT(handleSelectionChanged()));  m_proxyModel->setDynamicSortFilter(true);
-	m_proxyModel->sort(Qt::DisplayRole, Qt::AscendingOrder);
+	m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
+	m_proxyModel->setSortLocaleAware(true);
+	m_proxyModel->setSortRole(Qt::DisplayRole);
+	m_proxyModel->sort(0, Qt::AscendingOrder);
 	//TODO: save sorting role between sessions
 	//setup filter search line
 	KFilterProxySearchLine* searchLine = new KFilterProxySearchLine(this);
@@ -126,7 +129,7 @@ void Palapeli::CollectionView::sortMenuTriggered(QAction* action)
 	if (action == m_sortByPieceCount)
 		sortRole = Palapeli::Collection::PieceCountRole;
 	//update sorting and menu
-	m_proxyModel->sort(sortRole, Qt::AscendingOrder);
+	m_proxyModel->setSortRole(sortRole);
 	m_sortByTitle->setChecked(sortRole == Qt::DisplayRole);
 	m_sortByPieceCount->setChecked(sortRole == Palapeli::Collection::PieceCountRole);
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic