From 38a784f5af3e19936df29e93b70a66e3741f8ea8 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 14 Nov 2020 17:42:59 +0100 Subject: 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 --- desktop-widgets/tab-widgets/TabDiveEquipment.cpp | 1 - desktop-widgets/tab-widgets/maintab.cpp | 15 +++------------ 2 files changed, 3 insertions(+), 13 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp index 8a7fc63b5..5105029a3 100644 --- a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp +++ b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp @@ -127,7 +127,6 @@ void TabDiveEquipment::updateData() { cylindersModel->updateDive(current_dive); weightModel->updateDive(current_dive); - suitModel.updateModel(); ui.cylinders->view()->hideColumn(CylindersModel::DEPTH); bool is_ccr = current_dive && get_dive_dc(current_dive, dc_number)->divemode == CCR; diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 30c768c25..f519d6a0b 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -261,18 +261,12 @@ void MainTab::divesChanged(const QVector &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() -- cgit v1.2.3-70-g09d2