2019-12-18 09:50:21 +11:00
|
|
|
// The Clipboard class exposes system clipboard management and retrieval
|
|
|
|
// to QML.
|
|
|
|
|
2019-10-25 23:36:24 +11:00
|
|
|
#ifndef CLIPBOARD_H
|
|
|
|
#define CLIPBOARD_H
|
|
|
|
|
|
|
|
#include <QGuiApplication>
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
|
|
|
|
class Clipboard : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
|
|
|
|
Q_PROPERTY(QString selection READ selection WRITE setSelection
|
|
|
|
NOTIFY selectionChanged)
|
|
|
|
|
|
|
|
Q_PROPERTY(bool supportsSelection READ supportsSelection CONSTANT)
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit Clipboard(QObject *parent = 0);
|
|
|
|
|
2019-12-18 09:50:21 +11:00
|
|
|
// Normal primary clipboard
|
2019-10-25 23:36:24 +11:00
|
|
|
QString text() const;
|
|
|
|
void setText(const QString &text);
|
|
|
|
|
2019-12-18 09:50:21 +11:00
|
|
|
// X11 select-middle-click-paste clipboard
|
2019-10-25 23:36:24 +11:00
|
|
|
QString selection() const;
|
|
|
|
void setSelection(const QString &text);
|
|
|
|
|
|
|
|
bool supportsSelection() const;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void textChanged();
|
|
|
|
void selectionChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QClipboard *m_clipboard = QGuiApplication::clipboard();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|