mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive list: split reload() in reload() and setSortOrder()
The DiveListView code had a very fundamental problem with its header: Each had its own idea of who is responsible for sorting. Since we can't easily change QHeaderView, accept QHeaderView as the authority on sort-column and order. To make this possible, split the reload() function in two distinct functions: - reload() reloads the model and sorts according to the current sort criterion. - setSortOrder() tells the header to display a certain sort criterion. If this is a new criterion, it will then emit a signal. In this signal, resort according to that criterion. Thus, the actual sorting code has to be moved from the headerClicked() to a new sortIndicatorChanged() slot. Morover, the sorting of the QHeaderView has to be used. Reported-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
236373b6ba
commit
f2f18b4e16
4 changed files with 22 additions and 25 deletions
|
@ -25,7 +25,8 @@ public:
|
|||
void mouseDoubleClickEvent(QMouseEvent * event);
|
||||
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
void reload(DiveTripModel::Layout layout);
|
||||
void setSortOrder(int i, Qt::SortOrder order); // Call to set sort order
|
||||
void reload(); // Call to reload model data
|
||||
bool eventFilter(QObject *, QEvent *);
|
||||
void unselectDives();
|
||||
void clearTripSelection();
|
||||
|
@ -44,7 +45,7 @@ public
|
|||
slots:
|
||||
void toggleColumnVisibilityByIndex();
|
||||
void reloadHeaderActions();
|
||||
void headerClicked(int);
|
||||
void sortIndicatorChanged(int index, Qt::SortOrder order);
|
||||
void removeFromTrip();
|
||||
void deleteDive();
|
||||
void markDiveInvalid();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue