From f2f18b4e16656f0eb0d6b41981baa991ade3d33c Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 4 Nov 2018 17:54:38 +0100 Subject: 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 Signed-off-by: Berthold Stoeger --- desktop-widgets/tab-widgets/maintab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'desktop-widgets/tab-widgets') diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index d27a4730d..b61c9ab78 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -926,7 +926,7 @@ void MainTab::acceptChanges() int scrolledBy = MainWindow::instance()->diveList->verticalScrollBar()->sliderPosition(); resetPallete(); if (editMode == MANUALLY_ADDED_DIVE) { - MainWindow::instance()->diveList->reload(DiveTripModel::CURRENT); + MainWindow::instance()->diveList->reload(); int newDiveNr = get_divenr(get_dive_by_uniq_id(addedId)); MainWindow::instance()->diveList->unselectDives(); MainWindow::instance()->diveList->selectDive(newDiveNr, true); -- cgit v1.2.3-70-g09d2