mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive list model: send changed signals for top-level items
In analogy to the tree-model send signals when dives change their shown status in the list-view. Do this in two passes (collect changes; send changes) to be able to reuse the already existing functions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
c54e58e078
commit
7d5c15f49a
1 changed files with 9 additions and 0 deletions
|
@ -1320,6 +1320,12 @@ dive *DiveTripModelList::diveOrNull(const QModelIndex &index) const
|
|||
|
||||
void DiveTripModelList::recalculateFilter()
|
||||
{
|
||||
// Collect the changes in a vector used later to send signals.
|
||||
// This could be solved more efficiently in one pass, but
|
||||
// doing it in two passes allows us to use a common function without
|
||||
// resorting to co-routines, lambdas or similar techniques.
|
||||
std::vector<char> changed;
|
||||
changed.reserve(items.size());
|
||||
{
|
||||
// This marker prevents the UI from getting notifications on selection changes.
|
||||
// It is active until the end of the scope. See comment in DiveTripModelTree::recalculateFilter().
|
||||
|
@ -1332,6 +1338,9 @@ void DiveTripModelList::recalculateFilter()
|
|||
}
|
||||
}
|
||||
|
||||
// Send the data-changed signals if some items changed visibility.
|
||||
sendShownChangedSignals(changed, noParent);
|
||||
|
||||
emit diveListNotifier.numShownChanged();
|
||||
emit diveListNotifier.filterReset();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue