Desktop: Improve speed of selecting multiple (or all) dives

When selecting all dives via CTRL-A or manually and the trips
were not expanded, the QSelectionModel sends a single
selectionChanged signal per trip. We are reloading the map
in every call, making this very slow.

I couldn't figure out how to make QSelectionModel behave more
nicely, therefore I chose the nuclear option: Remove the map
reloading from selectionChanged() and hook into all functions
that do selection changes. In these functions, first call the
original code and then do the selection-changed operations.

This will certainly need some tuning.

Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-11-28 00:14:14 +01:00 committed by Dirk Hohndel
parent 7d77db96e3
commit 4928c4ae04
3 changed files with 42 additions and 33 deletions

View file

@ -70,6 +70,9 @@ slots:
void filterFinished();
void tripChanged(dive_trip *trip, TripField);
private:
void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags flags) override;
void selectAll() override;
void selectionChangeDone();
bool mouseClickSelection;
QList<int> expandedRows;
DiveTripModelBase::Layout currentLayout;