mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive trip model: send changed signals if visibility changed in trips
To avoid having to do full filter reloads, send dive-changed signals for dives in trips when the shown-status changed. But only for trips where not all dives are hidden. Because for those, the plan is to hide the trip as a whole. Implement the signal sending in its own function so that it can be reused for top-level items and the list-view. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
3cc6576913
commit
4ca65894c8
2 changed files with 38 additions and 4 deletions
|
@ -6,6 +6,8 @@
|
|||
#include "core/subsurface-qt/DiveListNotifier.h"
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
struct DiveFilter;
|
||||
|
||||
// There are two different representations of the dive list:
|
||||
// 1) Tree view: two-level model where dives are grouped by trips
|
||||
// 2) List view: one-level model where dives are sorted by one out
|
||||
|
@ -98,6 +100,7 @@ protected:
|
|||
// Access trip and dive data
|
||||
static QVariant diveData(const struct dive *d, int column, int role);
|
||||
static QVariant tripData(const dive_trip *trip, int column, int role);
|
||||
void sendShownChangedSignals(const std::vector<char> &changed, quintptr parentIndex);
|
||||
|
||||
virtual dive *diveOrNull(const QModelIndex &index) const = 0; // Returns a dive if this index represents a dive, null otherwise
|
||||
virtual void clearData() = 0;
|
||||
|
@ -130,6 +133,7 @@ private:
|
|||
void recalculateFilter();
|
||||
void divesChangedTrip(dive_trip *trip, const QVector<dive *> &dives);
|
||||
void divesTimeChangedTrip(dive_trip *trip, timestamp_t delta, const QVector<dive *> &dives);
|
||||
bool calculateFilterForTrip(const std::vector<dive *> &dives, const DiveFilter *filter, int parentIndex);
|
||||
|
||||
// The tree model has two levels. At the top level, we have either trips or dives
|
||||
// that do not belong to trips. Such a top-level item is represented by the "Item"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue