diff options
-rw-r--r-- | desktop-widgets/diveplanner.cpp | 8 | ||||
-rw-r--r-- | qt-models/diveplannermodel.cpp | 5 | ||||
-rw-r--r-- | qt-models/diveplannermodel.h | 3 |
3 files changed, 8 insertions, 8 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index f4deafa8c..014745909 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -50,12 +50,7 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent) : QWidget(parent, QFlag(0) view->setColumnHidden(CylindersModel::DEPTH, false); view->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this)); connect(ui.cylinderTableWidget, &TableView::addButtonClicked, plannerModel, &DivePlannerPointsModel::addCylinder_clicked); - - // addStop actually accept a call with no parameters, due to default parameters, but the connect() syntax without SIGNAL/SLOT - // does not understand default parameters and causes errors to be thrown. - // Continue to use old syntax, to avoid problems. - connect(ui.tableWidget, SIGNAL(addButtonClicked()), plannerModel, SLOT(addStop())); - + connect(ui.tableWidget, &TableView::addButtonClicked, plannerModel, &DivePlannerPointsModel::addDefaultStop); connect(cylinders, &CylindersModel::dataChanged, GasSelectionModel::instance(), &GasSelectionModel::repopulate); connect(cylinders, &CylindersModel::rowsInserted, GasSelectionModel::instance(), &GasSelectionModel::repopulate); connect(cylinders, &CylindersModel::rowsRemoved, GasSelectionModel::instance(), &GasSelectionModel::repopulate); @@ -64,7 +59,6 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent) : QWidget(parent, QFlag(0) connect(cylinders, &CylindersModel::rowsInserted, plannerModel, &DivePlannerPointsModel::cylinderModelEdited); connect(cylinders, &CylindersModel::rowsRemoved, plannerModel, &DivePlannerPointsModel::cylinderModelEdited); - ui.tableWidget->setBtnToolTip(tr("Add dive data point")); connect(ui.startTime, &QDateEdit::timeChanged, plannerModel, &DivePlannerPointsModel::setStartTime); connect(ui.dateEdit, &QDateEdit::dateChanged, plannerModel, &DivePlannerPointsModel::setStartDate); diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 945118b54..a7be4b975 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -750,6 +750,11 @@ int DivePlannerPointsModel::lastEnteredPoint() const return -1; } +void DivePlannerPointsModel::addDefaultStop() +{ + addStop(0, 0, -1, 0, true, UNDEF_COMP_TYPE); +} + // cylinderid_in == -1 means same gas as before. // divemode == UNDEF_COMP_TYPE means determine from previous point. int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_in, int ccpoint, bool entered, enum divemode_t divemode) diff --git a/qt-models/diveplannermodel.h b/qt-models/diveplannermodel.h index 978ce818d..52c01dd36 100644 --- a/qt-models/diveplannermodel.h +++ b/qt-models/diveplannermodel.h @@ -66,9 +66,10 @@ public: struct deco_state final_deco_state; void loadFromDive(dive *d); + int addStop(int millimeters, int seconds, int cylinderid_in, int ccpoint, bool entered, enum divemode_t); public slots: - int addStop(int millimeters = 0, int seconds = 0, int cylinderid_in = -1, int ccpoint = 0, bool entered = true, enum divemode_t = UNDEF_COMP_TYPE); + void addDefaultStop(); void addCylinder_clicked(); void setGFHigh(const int gfhigh); void setGFLow(const int gflow); |