mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
147a36647c
commit
b3253304a5
9 changed files with 34 additions and 35 deletions
|
@ -114,12 +114,14 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
|
|||
ui.dateEdit->setDisplayFormat(prefs.date_format);
|
||||
ui.tableWidget->setTitle(tr("Dive planner points"));
|
||||
ui.tableWidget->setModel(plannerModel);
|
||||
connect(ui.tableWidget, &TableView::itemClicked, plannerModel, &DivePlannerPointsModel::remove);
|
||||
plannerModel->setRecalc(true);
|
||||
ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::GAS, new AirTypesDelegate(this));
|
||||
ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::DIVEMODE, new DiveTypesDelegate(this));
|
||||
ui.cylinderTableWidget->setTitle(tr("Available gases"));
|
||||
ui.cylinderTableWidget->setBtnToolTip(tr("Add cylinder"));
|
||||
ui.cylinderTableWidget->setModel(CylindersModel::instance());
|
||||
connect(ui.cylinderTableWidget, &TableView::itemClicked, CylindersModel::instance(), &CylindersModel::remove);
|
||||
ui.waterType->setItemData(0, FRESHWATER_SALINITY);
|
||||
ui.waterType->setItemData(1, SEAWATER_SALINITY);
|
||||
ui.waterType->setItemData(2, EN13319_SALINITY);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue