fix: double click image will clear translate input line

This commit is contained in:
Xiao YiFang 2022-05-08 21:02:23 +08:00
parent 2c5f74445a
commit 20f51fc7f2

View file

@ -2275,6 +2275,11 @@ void ArticleView::doubleClicked( QPoint pos )
if ( cfg.preferences.doubleClickTranslates ) if ( cfg.preferences.doubleClickTranslates )
{ {
QString selectedText = ui.definition->selectedText(); QString selectedText = ui.definition->selectedText();
// ignore empty word;
if( selectedText.isEmpty() )
return;
emit sendWordToInputLine( selectedText ); emit sendWordToInputLine( selectedText );
// Do some checks to make sure there's a sensible selection indeed // Do some checks to make sure there's a sensible selection indeed
if ( Folding::applyWhitespaceOnly( gd::toWString( selectedText ) ).size() && if ( Folding::applyWhitespaceOnly( gd::toWString( selectedText ) ).size() &&