copy to clipboard

This commit is contained in:
msn 2013-11-24 21:23:21 +04:00
parent cfd0493c43
commit 8fd541973c

View File

@ -7,6 +7,7 @@
#include <QScreen> #include <QScreen>
#include <QThread> #include <QThread>
#include <QSettings> #include <QSettings>
#include <QClipboard>
#include <QMessageBox> #include <QMessageBox>
#include "Settings.h" #include "Settings.h"
@ -96,6 +97,17 @@ void Manager::processTrayAction(QSystemTrayIcon::ActivationReason reason)
QSystemTrayIcon::Information); QSystemTrayIcon::Information);
} }
} }
else if (reason == QSystemTrayIcon::MiddleClick)
{
if (!lastMessage_.isEmpty ())
{
QClipboard* clipboard = QApplication::clipboard ();
clipboard->setText (lastMessage_);
trayIcon_->showMessage (tr ("Последний перевод"),
tr ("Последний перевод был скопирован в буфер обмена."),
QSystemTrayIcon::Information);
}
}
} }
Manager::~Manager() Manager::~Manager()
@ -131,7 +143,7 @@ void Manager::about()
{ {
QString text = tr ("Программа для распознавания текста на экране.\n"\ QString text = tr ("Программа для распознавания текста на экране.\n"\
"Создана с использованием Qt, tesseract-ocr, Google Translate.\n" "Создана с использованием Qt, tesseract-ocr, Google Translate.\n"
"Автор: Gres (dariusiii@qip.ru)"); "Автор: Gres (onemoregres@gmail.com)");
QMessageBox message (QMessageBox::Information, tr ("О программе"), text, QMessageBox message (QMessageBox::Information, tr ("О программе"), text,
QMessageBox::Ok); QMessageBox::Ok);