mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:03:24 +00:00
Dive list: remove forceSort parameter from DiveListView::reload()
DiveListView::reload() was called for full reset of the dive list and for changing the view (tree vs. lis) in DiveListView::headerClicked(). Since the latter does sorting by itself, a parameter "forceSort" was introduced, which defaulted to true, but was set to false by DiveListView::headerClicked(). To remove complexity, simply let DiveListView::headerClicked() set the view by itself and remove tha parameter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
ade0d8e758
commit
6fb3a499e6
3 changed files with 5 additions and 7 deletions
|
@ -479,8 +479,9 @@ void DiveListView::headerClicked(int i)
|
||||||
unselectDives();
|
unselectDives();
|
||||||
if (currentLayout == DiveTripModel::TREE)
|
if (currentLayout == DiveTripModel::TREE)
|
||||||
backupExpandedRows();
|
backupExpandedRows();
|
||||||
reload(newLayout, false);
|
currentLayout = newLayout;
|
||||||
currentOrder = Qt::DescendingOrder;
|
currentOrder = Qt::DescendingOrder;
|
||||||
|
MultiFilterSortModel::instance()->setLayout(newLayout);
|
||||||
sortByColumn(i, currentOrder);
|
sortByColumn(i, currentOrder);
|
||||||
if (newLayout == DiveTripModel::TREE)
|
if (newLayout == DiveTripModel::TREE)
|
||||||
restoreExpandedRows();
|
restoreExpandedRows();
|
||||||
|
@ -490,7 +491,7 @@ void DiveListView::headerClicked(int i)
|
||||||
sortColumn = i;
|
sortColumn = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveListView::reload(DiveTripModel::Layout layout, bool forceSort)
|
void DiveListView::reload(DiveTripModel::Layout layout)
|
||||||
{
|
{
|
||||||
if (layout == DiveTripModel::CURRENT)
|
if (layout == DiveTripModel::CURRENT)
|
||||||
layout = currentLayout;
|
layout = currentLayout;
|
||||||
|
@ -499,9 +500,6 @@ void DiveListView::reload(DiveTripModel::Layout layout, bool forceSort)
|
||||||
|
|
||||||
MultiFilterSortModel::instance()->setLayout(layout);
|
MultiFilterSortModel::instance()->setLayout(layout);
|
||||||
|
|
||||||
if (!forceSort)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sortByColumn(sortColumn, currentOrder);
|
sortByColumn(sortColumn, currentOrder);
|
||||||
if (amount_selected && current_dive != NULL)
|
if (amount_selected && current_dive != NULL)
|
||||||
selectDive(get_divenr(current_dive), true);
|
selectDive(get_divenr(current_dive), true);
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
void mouseDoubleClickEvent(QMouseEvent * event);
|
void mouseDoubleClickEvent(QMouseEvent * event);
|
||||||
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||||
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||||
void reload(DiveTripModel::Layout layout, bool forceSort = true);
|
void reload(DiveTripModel::Layout layout);
|
||||||
bool eventFilter(QObject *, QEvent *);
|
bool eventFilter(QObject *, QEvent *);
|
||||||
void unselectDives();
|
void unselectDives();
|
||||||
void clearTripSelection();
|
void clearTripSelection();
|
||||||
|
|
|
@ -926,7 +926,7 @@ void MainTab::acceptChanges()
|
||||||
int scrolledBy = MainWindow::instance()->diveList->verticalScrollBar()->sliderPosition();
|
int scrolledBy = MainWindow::instance()->diveList->verticalScrollBar()->sliderPosition();
|
||||||
resetPallete();
|
resetPallete();
|
||||||
if (editMode == MANUALLY_ADDED_DIVE) {
|
if (editMode == MANUALLY_ADDED_DIVE) {
|
||||||
MainWindow::instance()->diveList->reload(DiveTripModel::CURRENT, true);
|
MainWindow::instance()->diveList->reload(DiveTripModel::CURRENT);
|
||||||
int newDiveNr = get_divenr(get_dive_by_uniq_id(addedId));
|
int newDiveNr = get_divenr(get_dive_by_uniq_id(addedId));
|
||||||
MainWindow::instance()->diveList->unselectDives();
|
MainWindow::instance()->diveList->unselectDives();
|
||||||
MainWindow::instance()->diveList->selectDive(newDiveNr, true);
|
MainWindow::instance()->diveList->selectDive(newDiveNr, true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue