diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-12-10 09:42:05 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-12-10 18:45:30 -0800 |
commit | f5d480711a3eb9a785e8e4b9bd65f19a8fd09cea (patch) | |
tree | 85eb0a3869b8bc5e1c576006c28a2ea1d2952763 /qt-models | |
parent | 6ec82a3c80e0f362abc59a6df8ea793013f01c65 (diff) | |
download | subsurface-f5d480711a3eb9a785e8e4b9bd65f19a8fd09cea.tar.gz |
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>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/divetripmodel.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 64bb28533..5c53d8ff8 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -742,7 +742,7 @@ void DiveTripModelTree::filterReset() // resorting to co-routines, lambdas or similar techniques. std::vector<char> changed; changed.reserve(items.size()); - + dive *old_current = current_dive; { // This marker prevents the UI from getting notifications on selection changes. // It is active until the end of the scope. @@ -780,6 +780,11 @@ void DiveTripModelTree::filterReset() } 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. std::vector<char> changed; changed.reserve(items.size()); + dive *old_current = current_dive; { // 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(). @@ -1349,6 +1355,11 @@ void DiveTripModelList::filterReset() sendShownChangedSignals(changed, noParent); 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 |