From 03bd3464320c377702a58656378a908b5cf999c2 Mon Sep 17 00:00:00 2001 From: Ettore Dreucci Date: Mon, 21 Aug 2017 02:02:33 +0200 Subject: [PATCH] Solve issue #847: Keyboard autofocus on search filed at startup Signed-off-by: Ettore Dreucci --- src/gui/MainWindow.cpp | 5 +++++ src/gui/SearchWidget.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index f1d5f866c..ec1406c4a 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -464,6 +464,11 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode) m_ui->actionDatabaseMerge->setEnabled(m_ui->tabWidget->currentIndex() != -1); m_searchWidgetAction->setEnabled(true); + + //if not already in search mode focus the search widget and select all its content + if (!inSearch) { + m_ui->toolBar->findChild("SearchWidget")->searchFocus(); + } break; } case DatabaseWidget::EditMode: diff --git a/src/gui/SearchWidget.h b/src/gui/SearchWidget.h index 2441ef60b..15e3488fb 100644 --- a/src/gui/SearchWidget.h +++ b/src/gui/SearchWidget.h @@ -55,13 +55,13 @@ signals: public slots: void databaseChanged(DatabaseWidget* dbWidget = 0); + void searchFocus(); private slots: void startSearchTimer(); void startSearch(); void updateCaseSensitive(); void updateLimitGroup(); - void searchFocus(); private: const QScopedPointer m_ui;