summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/tab-widgets/TabDiveEquipment.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
index d34b44c74..ea2d910ef 100644
--- a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
@@ -33,7 +33,6 @@ TabDiveEquipment::TabDiveEquipment(QWidget *parent) : TabBase(parent),
ui.weights->setModel(weightModel);
connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &TabDiveEquipment::divesChanged);
- connect(ui.cylinders, &TableView::itemClicked, cylindersModel, &CylindersModelFiltered::remove);
connect(ui.cylinders, &TableView::itemClicked, this, &TabDiveEquipment::editCylinderWidget);
connect(ui.weights, &TableView::itemClicked, this, &TabDiveEquipment::editWeightWidget);
@@ -164,14 +163,13 @@ void TabDiveEquipment::addWeight_clicked()
void TabDiveEquipment::editCylinderWidget(const QModelIndex &index)
{
- if (cylindersModel->model()->changed && !MainWindow::instance()->mainTab->isEditing()) {
- MainWindow::instance()->mainTab->enableEdition();
+ if (!index.isValid())
return;
- }
- if (index.isValid() && index.column() != CylindersModel::REMOVE) {
- MainWindow::instance()->mainTab->enableEdition();
+
+ if (index.column() == CylindersModel::REMOVE)
+ divesEdited(Command::removeCylinder(cylindersModel->mapToSource(index).row(), false));
+ else
ui.cylinders->edit(index);
- }
}
void TabDiveEquipment::editWeightWidget(const QModelIndex &index)