summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-11-02 08:09:00 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-11-02 07:46:01 -0700
commit76f38ff33b918d4880614ff277b4b611c0ce2998 (patch)
treed80af27105d2b012dd0c550a5b42728d871d5bb1
parent1ba15a91ae963d2cb1862b6f477c6fe7778abcef (diff)
downloadsubsurface-76f38ff33b918d4880614ff277b4b611c0ce2998.tar.gz
Dive list: invert default sort order for sort by date / number
Commit 6dc1d239f81f16133d5954bd2b21ffa0c2dcc755 introduced a well-defined sort order in the case of equal contents. It changed the code for sorting by date to simply use the order of the source model. BUT: The source-model was already sorted in descending order on date. Thus setting the default order on descening by date, the data was then presented as *ascending* by date. Change this back to descending by always using default-ascending in the filter model. Ultimately, the source model should simply reflect the ordering of the core-data (ascending on date), but such a change is too invasive shortly before release. Reported-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--desktop-widgets/divelistview.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index b669eb077..a31813697 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -27,7 +27,7 @@
#include "core/subsurface-qt/DiveListNotifier.h"
DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false), sortColumn(DiveTripModel::NR),
- currentOrder(Qt::DescendingOrder), dontEmitDiveChangedSignal(false), selectionSaved(false),
+ currentOrder(Qt::AscendingOrder), dontEmitDiveChangedSignal(false), selectionSaved(false),
initialColumnWidths(DiveTripModel::COLUMNS, 50) // Set up with default length 50
{
setItemDelegate(new DiveListDelegate(this));
@@ -465,11 +465,9 @@ void DiveListView::headerClicked(int i)
/* No layout change? Just re-sort, and scroll to first selection, making sure all selections are expanded */
if (currentLayout == newLayout) {
// If this is the same column as before, change sort order. Otherwise, choose a default
- // sort order (descending for NR and DATE, ascending elsewise).
+ // sort order (ascending).
if (sortColumn == i)
currentOrder = (currentOrder == Qt::DescendingOrder) ? Qt::AscendingOrder : Qt::DescendingOrder;
- else if (i == DiveTripModel::NR || i == DiveTripModel::DATE)
- currentOrder = Qt::DescendingOrder;
else
currentOrder = Qt::AscendingOrder;
sortByColumn(i, currentOrder);
@@ -480,7 +478,7 @@ void DiveListView::headerClicked(int i)
if (currentLayout == DiveTripModel::TREE)
backupExpandedRows();
currentLayout = newLayout;
- currentOrder = Qt::DescendingOrder;
+ currentOrder = Qt::AscendingOrder;
MultiFilterSortModel::instance()->setLayout(newLayout);
sortByColumn(i, currentOrder);
if (newLayout == DiveTripModel::TREE)