mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
fix: translatebox press Enter does not translate the selected item (#1134)
* fix: translatebox press Enter does not translate the selected item * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
283b406a8a
commit
8dd9119aec
|
@ -670,7 +670,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
connect( ui.translateLine, &QLineEdit::returnPressed, [ this ]() {
|
||||
translateInputFinished( true );
|
||||
} );
|
||||
connect( translateBox->translateLine(), &QLineEdit::returnPressed, [ this ]() {
|
||||
connect( translateBox, &TranslateBox::returnPressed, [ this ]() {
|
||||
translateInputFinished( true );
|
||||
} );
|
||||
|
||||
|
|
|
@ -53,8 +53,9 @@ TranslateBox::TranslateBox( QWidget * parent ):
|
|||
connect( completer,
|
||||
QOverload< const QString & >::of( &QCompleter::activated ),
|
||||
translate_line,
|
||||
[ & ]( const QString & ) {
|
||||
emit translate_line->returnPressed();
|
||||
[ & ]( const QString & text ) {
|
||||
translate_line->setText( text );
|
||||
emit returnPressed();
|
||||
} );
|
||||
}
|
||||
|
||||
|
@ -89,7 +90,7 @@ void TranslateBox::setModel( QStringList & _words )
|
|||
translate_line,
|
||||
[ & ]( const QString & text) {
|
||||
translate_line->setText(text);
|
||||
emit translate_line->returnPressed();
|
||||
emit returnPressed();
|
||||
} );
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,9 @@ public:
|
|||
public slots:
|
||||
void setPopupEnabled( bool enable );
|
||||
|
||||
signals:
|
||||
void returnPressed();
|
||||
|
||||
private slots:
|
||||
void showPopup();
|
||||
void rightButtonClicked();
|
||||
|
|
Loading…
Reference in a new issue