From 9e72e67ee7122caef2d3ed1d6d7df536a3af3fb5 Mon Sep 17 00:00:00 2001 From: Gres Date: Sat, 28 Mar 2020 14:31:11 +0300 Subject: [PATCH] Check if translated before copy to clipboard --- src/represent/representer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/represent/representer.cpp b/src/represent/representer.cpp index c3fc88c..2edd782 100644 --- a/src/represent/representer.cpp +++ b/src/represent/representer.cpp @@ -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.")); }