mirror of https://github.com/Nheko-Reborn/nheko
parent
7644b6e442
commit
f626de0447
@ -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(); |
||||
} |
@ -0,0 +1,18 @@ |
||||
#pragma once |
||||
|
||||
#include <QObject> |
||||
#include <QString> |
||||
|
||||
class Clipboard : public QObject |
||||
{ |
||||
Q_OBJECT |
||||
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) |
||||
|
||||
public: |
||||
Clipboard(QObject *parent = nullptr); |
||||
|
||||
QString text() const; |
||||
void setText(QString text_); |
||||
signals: |
||||
void textChanged(); |
||||
}; |
Loading…
Reference in new issue