Dive list: invert sort-direction to reflect core

Traditionally, the DiveTripModel has its data sorted in opposite
direction to the core-data (chronologically descending vs. ascending).
This bring a number of subtle problems. For example, when filling
the model, trips are filled according to the *last* dive, whereas
later insertion points are according to the ->when value from the
core, which depends on the *first* dive.

As a start of fixing these subtleties, change the sort direction
to reflect the core-data. Ideally, this should lead to a removal
of the redundant data-representation.

Since the model is now sorted in ascending order, sorting has to
be enabled in the DiveListView constructor to reflect the
default-descending order.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-11-06 21:48:18 +01:00 committed by Dirk Hohndel
parent 1aef22116c
commit 7046c8b342
2 changed files with 16 additions and 41 deletions

View file

@ -35,7 +35,7 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelec
setItemDelegateForColumn(DiveTripModel::RATING, new StarWidgetsDelegate(this));
setModel(MultiFilterSortModel::instance());
setSortingEnabled(false);
setSortingEnabled(true);
setContextMenuPolicy(Qt::DefaultContextMenu);
setSelectionMode(ExtendedSelection);
header()->setContextMenuPolicy(Qt::ActionsContextMenu);