Dive list: propagate current-item to frontend

The command-objects select a current item, but this selection
was not propagated to the front-end. The current item is the
base for keyboard-navigation through the dive-list and therefore
should be set correctly.

It took some experimentation to get the flags right:
 QItemSelectionModel::Current
Hopefully, these are the correct flags across all supported
Qt versions!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-08-14 09:12:21 -04:00 committed by Dirk Hohndel
parent b16be29595
commit 3c6cdfd8c0
6 changed files with 74 additions and 5 deletions

View file

@ -423,7 +423,12 @@ void DiveListBase::restoreSelection(const std::vector<dive *> &selection, dive *
});
bool currentDiveChanged = false;
if (current_dive != currentDive) {
// If currentDive is null, we have no current dive. In such a case always
// signal the frontend.
if (!currentDive) {
currentDiveChanged = true;
emit diveListNotifier.currentDiveChanged();
} else if (current_dive != currentDive) {
currentDiveChanged = true;
// We cannot simply change the currentd dive to the given dive.