From b61ecabed3ff42efa763c16ba827498cbf1d2ac8 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Fri, 17 Feb 2017 14:18:18 +0100 Subject: [PATCH] Fix sort order when searching, resolves #319 --- src/gui/entry/EntryView.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/entry/EntryView.cpp b/src/gui/entry/EntryView.cpp index d692c23c6..31fae3e58 100644 --- a/src/gui/entry/EntryView.cpp +++ b/src/gui/entry/EntryView.cpp @@ -140,15 +140,21 @@ Entry* EntryView::entryFromIndex(const QModelIndex& index) void EntryView::switchToEntryListMode() { m_sortModel->hideColumn(0, false); - sortByColumn(1, Qt::AscendingOrder); // TODO: should probably be improved + + m_sortModel->sort(1, Qt::AscendingOrder); + m_sortModel->sort(0, Qt::AscendingOrder); sortByColumn(0, Qt::AscendingOrder); + m_inEntryListMode = true; } void EntryView::switchToGroupMode() { m_sortModel->hideColumn(0, true); - sortByColumn(-1, Qt::AscendingOrder); + + m_sortModel->sort(-1, Qt::AscendingOrder); + m_sortModel->sort(0, Qt::AscendingOrder); sortByColumn(0, Qt::AscendingOrder); + m_inEntryListMode = false; }