Fix crash when pressing wrong shortcuts in welcome mode

Fixes: QTCREATORBUG-21302
Change-Id: Ib7e50f3cbd3e6e8f995b8cda7ad965f0cafde511
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Eike Ziller
2018-10-18 15:14:48 +02:00
parent 4dbc62a47e
commit d810c5b77f

View File

@@ -127,12 +127,18 @@ ProjectWelcomePage::ProjectWelcomePage()
auto act = new QAction(tr("Open Session #%1").arg(i), this);
Command *cmd = ActionManager::registerAction(act, sessionBase.withSuffix(i), welcomeContext);
cmd->setDefaultKeySequence(QKeySequence((useMacShortcuts ? tr("Ctrl+Meta+%1") : tr("Ctrl+Alt+%1")).arg(i)));
connect(act, &QAction::triggered, this, [this, i] { openSessionAt(i - 1); });
connect(act, &QAction::triggered, this, [this, i] {
if (i <= m_sessionModel->rowCount())
openSessionAt(i - 1);
});
act = new QAction(tr("Open Recent Project #%1").arg(i), this);
cmd = ActionManager::registerAction(act, projectBase.withSuffix(i), welcomeContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+%1").arg(i)));
connect(act, &QAction::triggered, this, [this, i] { openProjectAt(i - 1); });
connect(act, &QAction::triggered, this, [this, i] {
if (i <= m_projectModel->rowCount(QModelIndex()))
openProjectAt(i - 1);
});
}
}