mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
selection: avoid recursion in divelist selection code
When manually selecting a trip, the selectionChanged() virtual function was manually selecting the dives of the trip and thus ultimately recurse into itself. So far this seems to work OK, but better to avoid this recursion by setting the programmaticalSelectionChange flag. I'd like to send the selection-changed signal directly from selectionChanged() and this recursion would lead to double signals. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
8581e213ed
commit
018be753c3
1 changed files with 8 additions and 0 deletions
|
@ -534,6 +534,12 @@ void DiveListView::selectionChanged(const QItemSelection &selected, const QItemS
|
|||
return;
|
||||
}
|
||||
|
||||
// Avoid recursion: if later we decide to select all dives of a trip,
|
||||
// this function is called again. Avoid this by setting the
|
||||
// programmaticalSelectionChange flag. Note that the recursion never
|
||||
// was a problem, but it just feels correct to avoid this recursion.
|
||||
programmaticalSelectionChange = true;
|
||||
|
||||
// This is a manual selection change. This means that the core does not yet know
|
||||
// of the new selection. Update the core-structures accordingly and select/deselect
|
||||
// all dives of a trip if a trip is selected/deselected.
|
||||
|
@ -587,6 +593,8 @@ void DiveListView::selectionChanged(const QItemSelection &selected, const QItemS
|
|||
|
||||
// Display the new, processed, selection
|
||||
QTreeView::selectionChanged(selectionModel()->selection(), newDeselected);
|
||||
|
||||
programmaticalSelectionChange = false;
|
||||
}
|
||||
|
||||
enum asked_user {NOTYET, MERGE, DONTMERGE};
|
||||
|
|
Loading…
Reference in a new issue