| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QMIMEDATA_H |
| 5 | #define QMIMEDATA_H |
| 6 | |
| 7 | #include <QtCore/qvariant.h> |
| 8 | #include <QtCore/qobject.h> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | class QUrl; |
| 13 | class QMimeDataPrivate; |
| 14 | |
| 15 | class Q_CORE_EXPORT QMimeData : public QObject |
| 16 | { |
| 17 | Q_OBJECT |
| 18 | public: |
| 19 | QMimeData(); |
| 20 | ~QMimeData(); |
| 21 | |
| 22 | QList<QUrl> urls() const; |
| 23 | void setUrls(const QList<QUrl> &urls); |
| 24 | bool hasUrls() const; |
| 25 | |
| 26 | QString text() const; |
| 27 | void setText(const QString &text); |
| 28 | bool hasText() const; |
| 29 | |
| 30 | QString html() const; |
| 31 | void setHtml(const QString &html); |
| 32 | bool hasHtml() const; |
| 33 | |
| 34 | QVariant imageData() const; |
| 35 | void setImageData(const QVariant &image); |
| 36 | bool hasImage() const; |
| 37 | |
| 38 | QVariant colorData() const; |
| 39 | void setColorData(const QVariant &color); |
| 40 | bool hasColor() const; |
| 41 | |
| 42 | QByteArray data(const QString &mimetype) const; |
| 43 | void setData(const QString &mimetype, const QByteArray &data); |
| 44 | void removeFormat(const QString &mimetype); |
| 45 | |
| 46 | virtual bool hasFormat(const QString &mimetype) const; |
| 47 | virtual QStringList formats() const; |
| 48 | |
| 49 | void clear(); |
| 50 | |
| 51 | protected: |
| 52 | virtual QVariant retrieveData(const QString &mimetype, QMetaType preferredType) const; |
| 53 | |
| 54 | private: |
| 55 | Q_DISABLE_COPY(QMimeData) |
| 56 | Q_DECLARE_PRIVATE(QMimeData) |
| 57 | }; |
| 58 | |
| 59 | QT_END_NAMESPACE |
| 60 | |
| 61 | #endif // QMIMEDATA_H |
| 62 | |