mirror of
https://github.com/zealdocs/zeal.git
synced 2024-11-23 22:37:09 +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
|
// initialise ui
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
setupShortcuts();
|
||||||
|
|
||||||
restoreGeometry(settings.value("geometry").toByteArray());
|
restoreGeometry(settings.value("geometry").toByteArray());
|
||||||
ui->splitter->restoreState(settings.value("splitter").toByteArray());
|
ui->splitter->restoreState(settings.value("splitter").toByteArray());
|
||||||
connect(ui->splitter, &QSplitter::splitterMoved, [=](int, int) {
|
connect(ui->splitter, &QSplitter::splitterMoved, [=](int, int) {
|
||||||
@ -434,6 +437,15 @@ void MainWindow::bringToFront(bool withHack)
|
|||||||
#endif
|
#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_) {
|
void MainWindow::setHotKey(const QKeySequence& hotKey_) {
|
||||||
// platform-specific code for global key grabbing
|
// platform-specific code for global key grabbing
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -51,6 +51,7 @@ protected:
|
|||||||
settings.setValue("geometry", saveGeometry());
|
settings.setValue("geometry", saveGeometry());
|
||||||
QMainWindow::closeEvent(event);
|
QMainWindow::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
void setupShortcuts();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
Loading…
Reference in New Issue
Block a user