diff --git a/src/lib/sidebar/historysidebar.h b/src/lib/sidebar/historysidebar.h --- a/src/lib/sidebar/historysidebar.h +++ b/src/lib/sidebar/historysidebar.h @@ -36,6 +36,8 @@ public: explicit HistorySideBar(BrowserWindow* window, QWidget* parent = 0); + void showEvent(QShowEvent* event); + void focusSearchLine(); ~HistorySideBar(); private Q_SLOTS: diff --git a/src/lib/sidebar/historysidebar.cpp b/src/lib/sidebar/historysidebar.cpp --- a/src/lib/sidebar/historysidebar.cpp +++ b/src/lib/sidebar/historysidebar.cpp @@ -40,6 +40,17 @@ connect(ui->search, &QLineEdit::textEdited, ui->historyTree, &HistoryTreeView::search); } +void HistorySideBar::showEvent(QShowEvent* event) +{ + QWidget::showEvent(event); + HistorySideBar::focusSearchLine(); +} + +void HistorySideBar::focusSearchLine() +{ + ui->search->setFocus(); +} + void HistorySideBar::urlActivated(const QUrl &url) { openUrl(url);