forked from Stremio/stremio-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qclipboardproxy.cpp
31 lines (25 loc) · 893 Bytes
/
qclipboardproxy.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
#include "qclipboardproxy.h"
#include <QGuiApplication>
ClipboardProxy::ClipboardProxy(QObject *parent)
: QObject(parent)
{
QClipboard *clipboard = QGuiApplication::clipboard();
QObject::connect(clipboard, &QClipboard::dataChanged, this, &ClipboardProxy::dataChanged);
QObject::connect(clipboard, &QClipboard::selectionChanged, this, &ClipboardProxy::selectionChanged);
}
void ClipboardProxy::setDataText(const QString &text)
{
QGuiApplication::clipboard()->setText(text, QClipboard::Clipboard);
}
QString ClipboardProxy::dataText() const
{
return QGuiApplication::clipboard()->text(QClipboard::Clipboard);
}
void ClipboardProxy::setSelectionText(const QString &text)
{
QGuiApplication::clipboard()->setText(text, QClipboard::Selection);
}
QString ClipboardProxy::selectionText() const
{
return QGuiApplication::clipboard()->text(QClipboard::Selection);
}