From fa72288ca245e406fe8b05484c7110b9da53e46d Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Thu, 2 Jan 2020 15:05:54 +0100 Subject: [PATCH] desktop-widgets: remove use of QSignalMapper. QSignalMapper gives a warning that it is depreciated, and the doc. states that using a lambda function is more efficient. Replace use of QSignalMapper. Signed-off-by: Jan Iversen --- desktop-widgets/diveplanner.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index 7724fab92..73beae89f 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -458,11 +458,6 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) rebreather_modes.append(gettextFromC::tr(divemode_text_ui[i])); ui.rebreathermode->insertItems(0, rebreather_modes); - modeMapper = new QSignalMapper(this); - modeMapper->setMapping(ui.recreational_deco, int(RECREATIONAL)); - modeMapper->setMapping(ui.buehlmann_deco, int(BUEHLMANN)); - modeMapper->setMapping(ui.vpmb_deco, int(VPMB)); - connect(ui.recreational_deco, &QAbstractButton::clicked, [=] { plannerShared::set_planner_deco_mode(RECREATIONAL); }); connect(ui.buehlmann_deco, &QAbstractButton::clicked, [=] { plannerShared::set_planner_deco_mode(BUEHLMANN); }); connect(ui.vpmb_deco, &QAbstractButton::clicked, [=] { plannerShared::set_planner_deco_mode(VPMB); }); @@ -494,7 +489,10 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) connect(ui.rebreathermode, SIGNAL(currentIndexChanged(int)), plannerModel, SLOT(setRebreatherMode(int))); connect(ui.rebreathermode, SIGNAL(currentIndexChanged(int)), this, SLOT(setBailoutVisibility(int))); - connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(disableDecoElements(int))); + connect(ui.recreational_deco, &QAbstractButton::clicked, [=] { disableDecoElements(RECREATIONAL); }); + connect(ui.buehlmann_deco, &QAbstractButton::clicked, [=] { disableDecoElements(BUEHLMANN); }); + connect(ui.vpmb_deco, &QAbstractButton::clicked, [=] { disableDecoElements(VPMB); }); + connect(ui.ascRate75, SIGNAL(valueChanged(int)), plannerShared::instance(), SLOT(set_ascrate75(int))); connect(ui.ascRate50, SIGNAL(valueChanged(int)), plannerShared::instance(), SLOT(set_ascrate50(int))); connect(ui.descRate, SIGNAL(valueChanged(int)), plannerShared::instance(), SLOT(set_descrate(int)));