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