summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Hindenburg <[email protected]>2018-01-09 09:14:25 -0500
committerKurt Hindenburg <[email protected]>2018-01-09 09:14:25 -0500
commit3805cb9d9ddf51e19dff2a76bb9b24dc6346fa7c (patch)
tree2d00f2d02fa09d1969475094adbc76bfdb284fef
parent6b990498e7df854a0dc5deef3150ef4dd90fd443 (diff)
convert QSignalMapper (switchToTab shortcuts) to lambda
-rw-r--r--src/ViewManager.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp
index cb65299..a1a9455 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<void (QSignalMapper::*)(int)>(&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<void (QSignalMapper::*)()>(&QSignalMapper::map));
+
+ connect(switchToTabAction, &QAction::triggered, this,
+ [this, i]() {
+ switchToView(i);
+ });
collection->addAction(QStringLiteral("switch-to-tab-%1").arg(i), switchToTabAction);
}