From 18cb8e2132a80af6b6c365637198d820d394b6fe Mon Sep 17 00:00:00 2001 From: tobtoht Date: Fri, 2 Jul 2021 16:51:46 +0200 Subject: [PATCH] Coins: focus searchbar on toggle --- src/CoinsWidget.cpp | 5 +++++ src/CoinsWidget.h | 1 + src/MainWindow.cpp | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/CoinsWidget.cpp b/src/CoinsWidget.cpp index 97ac2df..95a6645 100644 --- a/src/CoinsWidget.cpp +++ b/src/CoinsWidget.cpp @@ -93,6 +93,11 @@ void CoinsWidget::setSearchbarVisible(bool visible) { ui->search->setVisible(visible); } +void CoinsWidget::focusSearchbar() { + ui->search->setFocusPolicy(Qt::StrongFocus); + ui->search->setFocus(); +} + void CoinsWidget::showContextMenu(const QPoint &point) { QModelIndexList list = ui->coins->selectionModel()->selectedRows(); diff --git a/src/CoinsWidget.h b/src/CoinsWidget.h index 87515d6..90471e2 100644 --- a/src/CoinsWidget.h +++ b/src/CoinsWidget.h @@ -28,6 +28,7 @@ public: public slots: void setSearchbarVisible(bool visible); + void focusSearchbar(); private slots: void showHeaderMenu(const QPoint& position); diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 7175ed6..703443c 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1483,6 +1483,8 @@ void MainWindow::toggleSearchbar(bool visible) { m_contactsWidget->focusSearchbar(); else if (currentTab == Tabs::RECEIVE) m_receiveWidget->focusSearchbar(); + else if (currentTab == Tabs::COINS) + m_coinsWidget->focusSearchbar(); } MainWindow::~MainWindow() = default; \ No newline at end of file