File indexing completed on 2024-06-02 03:41:59
0001 // SPDX-FileCopyrightText: 2019 Black Hat <bhat@encom.eu.org> 0002 // SPDX-License-Identifier: GPL-3.0-only 0003 0004 #pragma once 0005 0006 #include <QImage> 0007 #include <QObject> 0008 0009 class QClipboard; 0010 0011 /** 0012 * Clipboard proxy 0013 */ 0014 class Clipboard : public QObject 0015 { 0016 Q_OBJECT 0017 Q_PROPERTY(bool hasImage READ hasImage NOTIFY imageChanged) 0018 Q_PROPERTY(QImage image READ image NOTIFY imageChanged) 0019 0020 public: 0021 explicit Clipboard(QObject *parent = nullptr); 0022 0023 [[nodiscard]] bool hasImage() const; 0024 [[nodiscard]] QImage image() const; 0025 0026 Q_INVOKABLE QString saveImage(QString localPath = {}) const; 0027 0028 Q_INVOKABLE void saveText(QString message); 0029 0030 private: 0031 QClipboard *m_clipboard; 0032 0033 Q_SIGNALS: 0034 void imageChanged(); 0035 };