From 13cb0521fa4fd692f66a89c83ef17b7e3ea339bb Mon Sep 17 00:00:00 2001 From: Jani Mustonen Date: Fri, 3 Nov 2017 08:54:17 +0200 Subject: Improvements to the quick switcher (#109) - Ghetto disambiguation for the quick switcher - Fix the Ctrl+K shortcut - Fix keyboard focus when the quick switcher is closed fixes #114 --- src/MainWindow.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/MainWindow.cc') diff --git a/src/MainWindow.cc b/src/MainWindow.cc index 04576d44..9c81ef85 100644 --- a/src/MainWindow.cc +++ b/src/MainWindow.cc @@ -114,6 +114,11 @@ MainWindow::MainWindow(QWidget *parent) QShortcut *quitShortcut = new QShortcut(QKeySequence::Quit, this); connect(quitShortcut, &QShortcut::activated, this, QApplication::quit); + QShortcut *quickSwitchShortcut = new QShortcut(QKeySequence("Ctrl+K"), this); + connect(quickSwitchShortcut, &QShortcut::activated, this, [=]() { + chat_page_->showQuickSwitcher(); + }); + QSettings settings; trayIcon_->setVisible(userSettings_->isTrayEnabled()); @@ -127,15 +132,6 @@ MainWindow::MainWindow(QWidget *parent) } } -void -MainWindow::keyPressEvent(QKeyEvent *e) -{ - if ((e->key() == Qt::Key_K) && (e->modifiers().testFlag(Qt::ControlModifier))) - chat_page_->showQuickSwitcher(); - else - QMainWindow::keyPressEvent(e); -} - void MainWindow::restoreWindowSize() { -- cgit 1.5.1