diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-20 11:56:06 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-10-21 19:57:49 +0300 |
commit | 9829e49815de1b81b5c9848b71eaa810faab2bcf (patch) | |
tree | f95e3c46c00912a6aee699cb23803f74b173628a /desktop-widgets/divelistview.h | |
parent | 2f81890f496a21c852513a26b728e04e03c4f01e (diff) | |
download | subsurface-9829e49815de1b81b5c9848b71eaa810faab2bcf.tar.gz |
Dive list: move dive-selection code from filter to list
After invalidating the filter, the dive-selection was modified to
ensure that at least one dive is selected. This was done in the
filter code, but it seems preferrable to do this in the dive-list
code, which has direct access to the selection-model.
Therefore, move the code from MultiFilterSortModel to DiveListView.
While doing so, split the code in DiveListView into more functions to:
1) Get the index of the first dive (if any).
2) Select the first dive (if any).
This allows a distinct size reduction of conditional compilation
in MultiFilterSortModel (accesses to MainWindow are not possible
in mobile code).
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/divelistview.h')
-rw-r--r-- | desktop-widgets/divelistview.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/desktop-widgets/divelistview.h b/desktop-widgets/divelistview.h index 5c9ac2f25..c53e2aa01 100644 --- a/desktop-widgets/divelistview.h +++ b/desktop-widgets/divelistview.h @@ -29,8 +29,11 @@ public: bool eventFilter(QObject *, QEvent *); void unselectDives(); void clearTripSelection(); + void selectDive(QModelIndex index, bool scrollto = false, bool toggle = false); void selectDive(int dive_table_idx, bool scrollto = false, bool toggle = false); void selectDives(const QList<int> &newDiveSelection); + void selectFirstDive(); + QModelIndex indexOfFirstDive(); void rememberSelection(); void restoreSelection(); void contextMenuEvent(QContextMenuEvent *event); @@ -60,6 +63,7 @@ slots: void loadWebImages(); void diveSelectionChanged(const QVector<QModelIndex> &indexes, bool select); void currentDiveChanged(QModelIndex index); + void filterFinished(); private: bool mouseClickSelection; QList<int> expandedRows; |