Skip to content

Commit

Permalink
feat(ui): add support for the Ctrl+L shortcut (fixes #401)
Browse files Browse the repository at this point in the history
  • Loading branch information
trollixx committed Sep 24, 2018
1 parent cb2073f commit 83a8bb7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/libs/ui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,19 @@ MainWindow::MainWindow(Core::Application *app, QWidget *parent) :

setupTabBar();

QShortcut *focusSearch = new QShortcut(QStringLiteral("Ctrl+K"), this);
connect(focusSearch, &QShortcut::activated,
// Setup application wide shortcuts.
// Focus search bar.
QShortcut *shortcut = new QShortcut(QStringLiteral("Ctrl+K"), this);
connect(shortcut, &QShortcut::activated,
ui->lineEdit, static_cast<void (SearchEdit::*)()>(&SearchEdit::setFocus));

QShortcut *duplicate = new QShortcut(QStringLiteral("Ctrl+Alt+T"), this);
connect(duplicate, &QShortcut::activated, this, [this]() { duplicateTab(m_tabBar->currentIndex()); });
shortcut = new QShortcut(QStringLiteral("Ctrl+L"), this);
connect(shortcut, &QShortcut::activated,
ui->lineEdit, static_cast<void (SearchEdit::*)()>(&SearchEdit::setFocus));

// Duplicate current tab.
shortcut = new QShortcut(QStringLiteral("Ctrl+Alt+T"), this);
connect(shortcut, &QShortcut::activated, this, [this]() { duplicateTab(m_tabBar->currentIndex()); });

restoreGeometry(m_settings->windowGeometry);
ui->splitter->restoreState(m_settings->verticalSplitterGeometry);
Expand Down

0 comments on commit 83a8bb7

Please sign in to comment.