Commit 3805cb9d authored by Kurt Hindenburg's avatar Kurt Hindenburg

convert QSignalMapper (switchToTab shortcuts) to lambda

parent 6b990498
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment