From acbfef087006017fb9ecb499e4a65aebd520b412 Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Sun, 10 Nov 2024 23:38:32 -0500 Subject: [PATCH] opt: don't focus on the main window if word comes from headword dialog --- src/ui/mainwindow.cc | 15 +++++++-------- src/ui/mainwindow.hh | 1 - 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/ui/mainwindow.cc b/src/ui/mainwindow.cc index cbba62d4..31f085c1 100644 --- a/src/ui/mainwindow.cc +++ b/src/ui/mainwindow.cc @@ -3730,13 +3730,6 @@ void MainWindow::wordReceived( const QString & word ) respondToTranslationRequest( word, false ); } -void MainWindow::headwordReceived( const QString & word, const QString & ID ) -{ - toggleMainWindow( true ); - setInputLineText( word, WildcardPolicy::EscapeWildcards, NoPopupChange ); - respondToTranslationRequest( word, false, ArticleView::scrollToFromDictionaryId( ID ), false ); -} - void MainWindow::updateFavoritesMenu() { if ( ui.favoritesPane->isVisible() ) { @@ -4141,7 +4134,13 @@ void MainWindow::showDictionaryHeadwords( Dictionary::Class * dict ) headwordsDlg = new DictHeadwords( this, cfg, dict ); addGlobalActionsToDialog( headwordsDlg ); addGroupComboBoxActionsToDialog( headwordsDlg, groupList ); - connect( headwordsDlg, &DictHeadwords::headwordSelected, this, &MainWindow::headwordReceived ); + connect( headwordsDlg, + &DictHeadwords::headwordSelected, + this, + [ this ]( QString const & headword, QString const & dictID ) { + setInputLineText( headword, WildcardPolicy::EscapeWildcards, NoPopupChange ); + respondToTranslationRequest( headword, false, ArticleView::scrollToFromDictionaryId( dictID ), false ); + } ); connect( headwordsDlg, &DictHeadwords::closeDialog, this, diff --git a/src/ui/mainwindow.hh b/src/ui/mainwindow.hh index 51d3a2b5..51e8b06f 100644 --- a/src/ui/mainwindow.hh +++ b/src/ui/mainwindow.hh @@ -67,7 +67,6 @@ public slots: void messageFromAnotherInstanceReceived( QString const & ); void showStatusBarMessage( QString const &, int, QPixmap const & ); void wordReceived( QString const & ); - void headwordReceived( QString const &, QString const & ); void headwordFromFavorites( QString const &, QString const & ); void quitApp();