subsurface/desktop-widgets/tab-widgets/TabDiveExtraInfo.cpp
Berthold Stoeger b3253304a5 Desktop: don't connect to remove() slot of model from TableModel
When connecting a model to the TableModel class, it would connect
clicking on an item to the remove() slot of the model.

This breaks the program flow implied by the undo code:
Ui --> Undo-Command --> Model --> UI

Moreover, the naming of the remove() slot is illogical, because
clicks can also have different effects, as for example in the
cylinder-table.

Therefore, move the connect() call from TableModel to the
callers. In the case of TabDiveSite, move the remove() function
from the model to the TabWidget, where it makes more sense.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05 10:14:25 -08:00

29 lines
554 B
C++

// SPDX-License-Identifier: GPL-2.0
#include "TabDiveExtraInfo.h"
#include "ui_TabDiveExtraInfo.h"
#include "qt-models/divecomputerextradatamodel.h"
TabDiveExtraInfo::TabDiveExtraInfo(QWidget *parent) :
TabBase(parent),
ui(new Ui::TabDiveExtraInfo()),
extraDataModel(new ExtraDataModel())
{
ui->setupUi(this);
ui->extraData->setModel(extraDataModel);
}
TabDiveExtraInfo::~TabDiveExtraInfo()
{
delete ui;
}
void TabDiveExtraInfo::updateData()
{
extraDataModel->updateDive();
}
void TabDiveExtraInfo::clear()
{
extraDataModel->updateDive();
}