From 3805cb9d9ddf51e19dff2a76bb9b24dc6346fa7c Mon Sep 17 00:00:00 2001 From: Kurt Hindenburg Date: Tue, 9 Jan 2018 09:14:25 -0500 Subject: [PATCH] convert QSignalMapper (switchToTab shortcuts) to lambda --- src/ViewManager.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index cb652994d..a1a945595 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -223,14 +223,13 @@ void ViewManager::setupActions() // Switch to tab N shortcuts const int SWITCH_TO_TAB_COUNT = 19; - auto switchToTabMapper = new QSignalMapper(this); - connect(switchToTabMapper, static_cast(&QSignalMapper::mapped), - this, &Konsole::ViewManager::switchToView); for (int i = 0; i < SWITCH_TO_TAB_COUNT; i++) { QAction *switchToTabAction = new QAction(i18nc("@action Shortcut entry", "Switch to Tab %1", i + 1), this); - switchToTabMapper->setMapping(switchToTabAction, i); - connect(switchToTabAction, &QAction::triggered, switchToTabMapper, - static_cast(&QSignalMapper::map)); + + connect(switchToTabAction, &QAction::triggered, this, + [this, i]() { + switchToView(i); + }); collection->addAction(QStringLiteral("switch-to-tab-%1").arg(i), switchToTabAction); }