From d68c3d8ab5353ed736249d705e7683dc8f5d6062 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 23 Jan 2021 11:41:42 +0100 Subject: cleanup: add DivePlannerPointsModel::addDefaultStop() function When clicking on "+" in the planner, a default stop point was added using a signal/slot connection. This used the archaic string-based connect syntax, because it was realized with default parameters passed to "addStop()". Instead, add a "addDefaultStop()" slot, which passes the default parameters. Since all other callers do not use callbacks, unslotify "addStop()". The slot was the only user of the default parameters, so they can be removed alltogether. Signed-off-by: Berthold Stoeger --- desktop-widgets/diveplanner.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'desktop-widgets') 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); -- cgit v1.2.3-70-g09d2