Added ability to copy last result to clipboard from ResultDialog.
This commit is contained in:
parent
283b596ef1
commit
54f809707c
@ -71,6 +71,7 @@ Manager::Manager (QObject *parent) :
|
||||
connect (this, SIGNAL (settingsEdited ()), resultDialog_, SLOT (applySettings ()));
|
||||
connect (resultDialog_, SIGNAL (requestRecognize (ProcessingItem)),
|
||||
this, SIGNAL (requestRecognize (ProcessingItem)));
|
||||
connect (resultDialog_, SIGNAL (requestClipboard ()), SLOT (copyLastToClipboard ()));
|
||||
|
||||
|
||||
connect (trayIcon_, SIGNAL (activated (QSystemTrayIcon::ActivationReason)),
|
||||
|
@ -11,7 +11,7 @@ ResultDialog::ResultDialog (const LanguageHelper &dictionary, QWidget *parent) :
|
||||
QDialog (parent),
|
||||
ui (new Ui::ResultDialog),
|
||||
dictionary_ (dictionary), isShowAtCapturePos_ (true),
|
||||
contextMenu_ (NULL), recognizeSubMenu_ (NULL) {
|
||||
contextMenu_ (NULL), recognizeSubMenu_ (NULL), clipboardAction_ (NULL) {
|
||||
ui->setupUi (this);
|
||||
setWindowFlags (Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint |
|
||||
Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
|
||||
@ -37,6 +37,7 @@ void ResultDialog::applySettings () {
|
||||
void ResultDialog::createContextMenu () {
|
||||
contextMenu_ = new QMenu ();
|
||||
recognizeSubMenu_ = contextMenu_->addMenu (tr ("Распознать другой язык"));
|
||||
clipboardAction_ = contextMenu_->addAction (tr ("Скопировать в буфер"));
|
||||
}
|
||||
|
||||
bool ResultDialog::eventFilter (QObject *object, QEvent *event) {
|
||||
@ -52,6 +53,9 @@ bool ResultDialog::eventFilter (QObject *object, QEvent *event) {
|
||||
item.ocrLanguage = dictionary_.ocrUiToCode (action->text ());
|
||||
emit requestRecognize (item);
|
||||
}
|
||||
else if (action == clipboardAction_) {
|
||||
emit requestClipboard ();
|
||||
}
|
||||
}
|
||||
hide ();
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ class ResultDialog : public QDialog {
|
||||
|
||||
signals:
|
||||
void requestRecognize (ProcessingItem item);
|
||||
void requestClipboard (); // Assume that slot will be called immediately.
|
||||
|
||||
public:
|
||||
const ProcessingItem &item () const;
|
||||
@ -38,6 +39,7 @@ class ResultDialog : public QDialog {
|
||||
bool isShowAtCapturePos_;
|
||||
QMenu *contextMenu_;
|
||||
QMenu *recognizeSubMenu_;
|
||||
QAction *clipboardAction_;
|
||||
ProcessingItem item_;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user