mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Filter: prevent selection-change notifications in filter invalidation
Invalidating the filter can cause numerous selection-change notifications. These cause a full UI reload. Therefore, go into "command" mode that was implemented for the undo commands. Then, all selection-changes are considered as "programmatical" and ignored. At the end of filter invalidation, a filter-finished signal causes a proper reload anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
4e81edcf1e
commit
29c6aea797
1 changed files with 24 additions and 12 deletions
|
@ -227,6 +227,16 @@ void MultiFilterSortModel::myInvalidate()
|
||||||
int i;
|
int i;
|
||||||
struct dive *d;
|
struct dive *d;
|
||||||
|
|
||||||
|
{
|
||||||
|
// This marker prevents the UI from getting notifications on selection changes.
|
||||||
|
// It is active until the end of the scope.
|
||||||
|
// This is actually meant for the undo-commands, so that they can do their work
|
||||||
|
// without having the UI updated.
|
||||||
|
// Here, it is used because invalidating the filter can generate numerous
|
||||||
|
// selection changes, which do full ui reloads. Instead, do that all at once
|
||||||
|
// as a consequence of the filterFinished signal right after the local scope.
|
||||||
|
auto marker = diveListNotifier.enterCommand();
|
||||||
|
|
||||||
divesDisplayed = 0;
|
divesDisplayed = 0;
|
||||||
|
|
||||||
// Apply filter for each dive
|
// Apply filter for each dive
|
||||||
|
@ -242,6 +252,8 @@ void MultiFilterSortModel::myInvalidate()
|
||||||
// Tell the dive trip model to update the displayed-counts
|
// Tell the dive trip model to update the displayed-counts
|
||||||
DiveTripModelBase::instance()->filterFinished();
|
DiveTripModelBase::instance()->filterFinished();
|
||||||
countsChanged();
|
countsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
emit filterFinished();
|
emit filterFinished();
|
||||||
|
|
||||||
#if !defined(SUBSURFACE_MOBILE)
|
#if !defined(SUBSURFACE_MOBILE)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue