mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
Merge pull request #1064 from xiaoyifang/fix/completer-signal
fix: qcompleter lost signal when qlineedit lost focus
This commit is contained in:
commit
64b1863208
|
@ -2396,10 +2396,7 @@ void MainWindow::respondToTranslationRequest( QString const & word, bool checkMo
|
|||
activateWindow();
|
||||
}
|
||||
|
||||
auto view = getCurrentArticleView();
|
||||
|
||||
view->activateWindow();
|
||||
view->focus();
|
||||
focusArticleView();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2586,7 +2583,7 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
|
|||
activateWindow();
|
||||
}
|
||||
|
||||
getCurrentArticleView()->focus();
|
||||
focusArticleView();
|
||||
|
||||
return cfg.preferences.searchInDock;
|
||||
}
|
||||
|
|
|
@ -79,9 +79,17 @@ void TranslateBox::setSizePolicy( QSizePolicy policy )
|
|||
|
||||
void TranslateBox::setModel( QStringList & _words )
|
||||
{
|
||||
disconnect( completer, 0, translate_line, 0 );
|
||||
auto model = (QStringListModel *)( completer->model() );
|
||||
|
||||
model->setStringList( _words );
|
||||
|
||||
connect( completer,
|
||||
QOverload< const QString & >::of( &QCompleter::activated ),
|
||||
translate_line,
|
||||
[ & ]( const QString & ) {
|
||||
emit translate_line->returnPressed();
|
||||
} );
|
||||
}
|
||||
|
||||
void TranslateBox::showPopup()
|
||||
|
|
Loading…
Reference in a new issue