-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclipboarddictionary.cpp
39 lines (32 loc) · 1005 Bytes
/
clipboarddictionary.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "clipboarddictionary.h"
#include <QHotkey>
ClipBoardDictionary::ClipBoardDictionary(QObject *parent) : QObject(parent)
{
clipboard = QGuiApplication::clipboard();
QObject::connect(clipboard,SIGNAL(dataChanged()),this,SLOT(setData()));
shortCut = new QHotkey(QKeySequence("ctrl+T"), true, this);//The hotkey will be automatically registered
qDebug() << "Platform is supported" << clipboard->supportsFindBuffer();
qDebug() << "Is Registered: " << shortCut->isRegistered();
if (shortCut != NULL)
QObject::connect(shortCut, SIGNAL(activated()), this, SLOT(copyToBuffer()));
}
void ClipBoardDictionary::copyToBuffer()
{
setWord(clipboard->text(clipboard->Clipboard));
}
QString ClipBoardDictionary::getWord()
{
return p_word;
}
void ClipBoardDictionary::setWord(QString word)
{
p_word = word;
emit wordChanged();
qDebug() << "Data was copied";
qDebug() << p_word;
}
void ClipBoardDictionary::setData()
{
copyToBuffer();
// restoreClipBoard();
}