summary refs log tree commit diff
path: root/src/Clipboard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Clipboard.cpp')
-rw-r--r--src/Clipboard.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Clipboard.cpp b/src/Clipboard.cpp
new file mode 100644
index 00000000..720f30fd
--- /dev/null
+++ b/src/Clipboard.cpp
@@ -0,0 +1,23 @@
+#include "Clipboard.h"
+
+#include <QClipboard>
+#include <QGuiApplication>
+
+Clipboard::Clipboard(QObject *parent)
+  : QObject(parent)
+{
+        connect(
+          QGuiApplication::clipboard(), &QClipboard::dataChanged, this, &Clipboard::textChanged);
+}
+
+void
+Clipboard::setText(QString text)
+{
+        QGuiApplication::clipboard()->setText(text);
+}
+
+QString
+Clipboard::text() const
+{
+        return QGuiApplication::clipboard()->text();
+}