desktop: automatically reload completion-models

Instead of programatically reload the completion models, listen
to the relevant signals in the models. To that goal, derive all
the models from a base class.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-11-14 17:42:59 +01:00 committed by Dirk Hohndel
parent 52d5125926
commit 38a784f5af
5 changed files with 83 additions and 36 deletions

View file

@ -261,18 +261,12 @@ void MainTab::divesChanged(const QVector<dive *> &dives, DiveField field)
}
if (field.divesite)
updateDiveSite(current_dive);
if (field.tags) {
tagModel.updateModel(); // TODO: Don't do this here
if (field.tags)
ui.tagWidget->setText(get_taglist_string(current_dive->tag_list));
}
if (field.buddy) {
buddyModel.updateModel(); // TODO: Don't do this here
if (field.buddy)
ui.buddy->setText(current_dive->buddy);
}
if (field.divemaster) {
diveMasterModel.updateModel(); // TODO: Don't do this here
if (field.divemaster)
ui.divemaster->setText(current_dive->divemaster);
}
// If duration or depth changed, the profile needs to be replotted
if (field.duration || field.depth)
@ -499,9 +493,6 @@ void MainTab::updateDiveInfo()
void MainTab::reload()
{
buddyModel.updateModel();
diveMasterModel.updateModel();
tagModel.updateModel();
}
void MainTab::refreshDisplayedDiveSite()