KDeclarative

MimeDataWrapper.h
1 /*
2  Copyright (C) 2015 by Aleix Pol Gonzalez <[email protected]>
3 
4  Permission is hereby granted, free of charge, to any person obtaining a copy
5  of this software and associated documentation files (the "Software"), to deal
6  in the Software without restriction, including without limitation the rights
7  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  copies of the Software, and to permit persons to whom the Software is
9  furnished to do so, subject to the following conditions:
10 
11  The above copyright notice and this permission notice shall be included in
12  all copies or substantial portions of the Software.
13 
14  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  THE SOFTWARE.
21 */
22 
23 #ifndef MIMEDATAWRAPPER_H
24 #define MIMEDATAWRAPPER_H
25 
26 #include <QObject>
27 #include <QString>
28 #include <QJsonArray>
29 
30 class QMimeData;
31 class QObject;
37 class MimeDataWrapper : public QObject
38 {
39  Q_OBJECT
40 
44  Q_PROPERTY(QString text READ text CONSTANT)
45 
46 
49  Q_PROPERTY(QString html READ html CONSTANT)
50 
54  Q_PROPERTY(QUrl url READ url CONSTANT)
55 
60  Q_PROPERTY(QJsonArray urls READ urls CONSTANT)
61 
65  Q_PROPERTY(QVariant color READ color CONSTANT)
66 
70  Q_PROPERTY(QVariant source READ source CONSTANT)
71 
77  Q_PROPERTY(QStringList formats READ formats CONSTANT)
78 
82  Q_PROPERTY(bool hasUrls READ hasUrls CONSTANT)
83 
87  Q_PROPERTY(QMimeData* mimeData READ mimeData CONSTANT)
88 
89 public:
90  MimeDataWrapper(const QMimeData* data, QObject* parent);
91 
92  QString text() const;
93  QString html() const;
94  QUrl url() const;
95  QJsonArray urls() const;
96  bool hasUrls() const;
97  QVariant color() const;
98  QStringList formats() const;
99  QVariant source() const;
100  QMimeData* mimeData() const;
101 
102  Q_INVOKABLE QByteArray getDataAsByteArray(const QString& format);
103 
104 private:
105  const QMimeData* m_data;
106 };
107 
108 #endif
Q_OBJECTQ_OBJECT
Exposes a const QMimeData instance.
Q_PROPERTY(...)
Q_INVOKABLEQ_INVOKABLE
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Aug 7 2020 22:37:05 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.