tab-widgets: pass current dive computer to delegates

Don't access the global current_dc, but pass it to the sensor and
tank-use delegates, when the current dive or dive computer changes.
The same pattern is already realized for the tank and weight models.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-09-17 16:55:44 +02:00 committed by bstoeger
parent 32de8a1387
commit 19baae449d
6 changed files with 48 additions and 33 deletions

View file

@ -138,8 +138,12 @@ void TabDiveEquipment::toggleTriggeredColumn()
void TabDiveEquipment::updateData(const std::vector<dive *> &, dive *currentDive, int currentDC)
{
divecomputer *dc = get_dive_dc(currentDive, currentDC);
cylindersModel->updateDive(currentDive, currentDC);
weightModel->updateDive(currentDive);
sensorDelegate.setCurrentDC(dc);
tankUseDelegate.setCurrentDC(dc);
if (currentDive && currentDive->suit)
ui.suit->setText(QString(currentDive->suit));