Check if translated before copy to clipboard

This commit is contained in:
Gres 2020-03-28 14:31:11 +03:00
parent 258073c785
commit 9e72e67ee7

View File

@ -29,8 +29,10 @@ void Representer::clipboardLast()
SOFT_ASSERT(widget_->task(), return );
const auto task = widget_->task();
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(task->recognized + QLatin1String(" - ") +
task->translated);
auto text = task->recognized;
if (!task->translated.isEmpty())
text += QLatin1String(" - ") + task->translated;
clipboard->setText(text);
tray_.showInformation(
QObject::tr("The last result was copied to the clipboard."));
}