mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Filter: instruct UI of changed current dive
Updating the filter can lead to changes of the current dive. Keep the UI in the know by re-initializing the selection. This is not optimal, because the whole selection is reset, but the pragmatic thing to do for now. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
6ec82a3c80
commit
f5d480711a
1 changed files with 12 additions and 1 deletions
|
@ -742,7 +742,7 @@ void DiveTripModelTree::filterReset()
|
||||||
// resorting to co-routines, lambdas or similar techniques.
|
// resorting to co-routines, lambdas or similar techniques.
|
||||||
std::vector<char> changed;
|
std::vector<char> changed;
|
||||||
changed.reserve(items.size());
|
changed.reserve(items.size());
|
||||||
|
dive *old_current = current_dive;
|
||||||
{
|
{
|
||||||
// This marker prevents the UI from getting notifications on selection changes.
|
// This marker prevents the UI from getting notifications on selection changes.
|
||||||
// It is active until the end of the scope.
|
// It is active until the end of the scope.
|
||||||
|
@ -780,6 +780,11 @@ void DiveTripModelTree::filterReset()
|
||||||
}
|
}
|
||||||
|
|
||||||
emit diveListNotifier.numShownChanged();
|
emit diveListNotifier.numShownChanged();
|
||||||
|
|
||||||
|
// If the current dive changed, instruct the UI of the changed selection
|
||||||
|
// TODO: This is way to heavy, as it reloads the whole selection!
|
||||||
|
if (old_current != current_dive)
|
||||||
|
initSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1333,6 +1338,7 @@ void DiveTripModelList::filterReset()
|
||||||
// resorting to co-routines, lambdas or similar techniques.
|
// resorting to co-routines, lambdas or similar techniques.
|
||||||
std::vector<char> changed;
|
std::vector<char> changed;
|
||||||
changed.reserve(items.size());
|
changed.reserve(items.size());
|
||||||
|
dive *old_current = current_dive;
|
||||||
{
|
{
|
||||||
// This marker prevents the UI from getting notifications on selection changes.
|
// This marker prevents the UI from getting notifications on selection changes.
|
||||||
// It is active until the end of the scope. See comment in DiveTripModelTree::filterReset().
|
// It is active until the end of the scope. See comment in DiveTripModelTree::filterReset().
|
||||||
|
@ -1349,6 +1355,11 @@ void DiveTripModelList::filterReset()
|
||||||
sendShownChangedSignals(changed, noParent);
|
sendShownChangedSignals(changed, noParent);
|
||||||
|
|
||||||
emit diveListNotifier.numShownChanged();
|
emit diveListNotifier.numShownChanged();
|
||||||
|
|
||||||
|
// If the current dive changed, instruct the UI of the changed selection
|
||||||
|
// TODO: This is way to heavy, as it reloads the whole selection!
|
||||||
|
if (old_current != current_dive)
|
||||||
|
initSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant DiveTripModelList::data(const QModelIndex &index, int role) const
|
QVariant DiveTripModelList::data(const QModelIndex &index, int role) const
|
||||||
|
|
Loading…
Add table
Reference in a new issue