Transform Clipboard to singleton and add rich text copying feature
This commit is contained in:
37
src/clipboard.h
Normal file
37
src/clipboard.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Black Hat <bhat@encom.eu.org>
|
||||
*
|
||||
* SPDX-LicenseIdentifier: GPL-3.0-only
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class QClipboard;
|
||||
class QImage;
|
||||
|
||||
/**
|
||||
* Clipboard proxy
|
||||
*/
|
||||
class Clipboard : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool hasImage READ hasImage NOTIFY imageChanged)
|
||||
Q_PROPERTY(QImage image READ image NOTIFY imageChanged)
|
||||
|
||||
public:
|
||||
explicit Clipboard(QObject *parent = nullptr);
|
||||
|
||||
bool hasImage() const;
|
||||
QImage image() const;
|
||||
|
||||
Q_INVOKABLE bool saveImage(const QUrl &localPath);
|
||||
|
||||
Q_INVOKABLE void saveText(QString message);
|
||||
|
||||
private:
|
||||
QClipboard *m_clipboard;
|
||||
|
||||
Q_SIGNALS:
|
||||
void imageChanged();
|
||||
};
|
||||
Reference in New Issue
Block a user