mirror of
https://github.com/zealdocs/zeal.git
synced 2024-11-27 11:44:56 +03:00
Add Ctrl+K shortcut for focusing search text
This commit is contained in:
parent
22cfff3e69
commit
a4125be39f
@ -108,6 +108,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
// initialise ui
|
||||
ui->setupUi(this);
|
||||
|
||||
setupShortcuts();
|
||||
|
||||
restoreGeometry(settings.value("geometry").toByteArray());
|
||||
ui->splitter->restoreState(settings.value("splitter").toByteArray());
|
||||
connect(ui->splitter, &QSplitter::splitterMoved, [=](int, int) {
|
||||
@ -434,6 +437,15 @@ void MainWindow::bringToFront(bool withHack)
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::setupShortcuts()
|
||||
{
|
||||
QShortcut* focusSearch = new QShortcut(QKeySequence("Ctrl+K"), this);
|
||||
focusSearch->setContext(Qt::ApplicationShortcut);
|
||||
connect(focusSearch, &QShortcut::activated, [=]() {
|
||||
ui->lineEdit->setFocus();
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::setHotKey(const QKeySequence& hotKey_) {
|
||||
// platform-specific code for global key grabbing
|
||||
#ifdef WIN32
|
||||
|
@ -51,6 +51,7 @@ protected:
|
||||
settings.setValue("geometry", saveGeometry());
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
void setupShortcuts();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
Loading…
Reference in New Issue
Block a user