desktop-widgets: replace QSignalMapper for set_deco_mode

QSignalMapper had a parameter convert problem, when mapping to
set_deco_mode in plannerShared.

Use lambda function in connect to avoid parameter convert problem.

Signed-off-by: Jan Iversen <jan@casacondor.com>
This commit is contained in:
jan Iversen 2020-01-02 14:35:49 +01:00 committed by Dirk Hohndel
parent f1bb2a81ca
commit e2d568acc1

View file

@ -459,14 +459,13 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
ui.rebreathermode->insertItems(0, rebreather_modes);
modeMapper = new QSignalMapper(this);
connect(modeMapper, SIGNAL(mapped(int)) , plannerShared::instance(), SLOT(set_planner_deco_mode(int)));
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, SIGNAL(clicked()), modeMapper, SLOT(map()));
connect(ui.buehlmann_deco, SIGNAL(clicked()), modeMapper, SLOT(map()));
connect(ui.vpmb_deco, SIGNAL(clicked()), modeMapper, SLOT(map()));
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); });
connect(ui.lastStop, SIGNAL(toggled(bool)), plannerShared::instance(), SLOT(set_last_stop(bool)));
connect(ui.lastStop, SIGNAL(toggled(bool)), this, SLOT(disableBackgasBreaks(bool)));