Coins: focus searchbar on toggle

This commit is contained in:
tobtoht 2021-07-02 16:51:46 +02:00
parent 3b06ca4b17
commit 18cb8e2132
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
3 changed files with 8 additions and 0 deletions

View file

@ -93,6 +93,11 @@ void CoinsWidget::setSearchbarVisible(bool visible) {
ui->search->setVisible(visible); ui->search->setVisible(visible);
} }
void CoinsWidget::focusSearchbar() {
ui->search->setFocusPolicy(Qt::StrongFocus);
ui->search->setFocus();
}
void CoinsWidget::showContextMenu(const QPoint &point) { void CoinsWidget::showContextMenu(const QPoint &point) {
QModelIndexList list = ui->coins->selectionModel()->selectedRows(); QModelIndexList list = ui->coins->selectionModel()->selectedRows();

View file

@ -28,6 +28,7 @@ public:
public slots: public slots:
void setSearchbarVisible(bool visible); void setSearchbarVisible(bool visible);
void focusSearchbar();
private slots: private slots:
void showHeaderMenu(const QPoint& position); void showHeaderMenu(const QPoint& position);

View file

@ -1483,6 +1483,8 @@ void MainWindow::toggleSearchbar(bool visible) {
m_contactsWidget->focusSearchbar(); m_contactsWidget->focusSearchbar();
else if (currentTab == Tabs::RECEIVE) else if (currentTab == Tabs::RECEIVE)
m_receiveWidget->focusSearchbar(); m_receiveWidget->focusSearchbar();
else if (currentTab == Tabs::COINS)
m_coinsWidget->focusSearchbar();
} }
MainWindow::~MainWindow() = default; MainWindow::~MainWindow() = default;