KDeclarative

MimeDataWrapper.h
1/*
2 SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
3
4 SPDX-License-Identifier: MIT
5*/
6
7#ifndef MIMEDATAWRAPPER_H
8#define MIMEDATAWRAPPER_H
9
10#include <QJsonArray>
11#include <QObject>
12#include <QString>
13
14class QMimeData;
15class QObject;
16/**
17 * Exposes a const QMimeData instance
18 *
19 * In contrast to DeclarativeMimeData, doesn't create a copy of the QMimeData instance
20 */
22{
24
25 /**
26 * A plain text (MIME type text/plain) representation of the data.
27 */
28 Q_PROPERTY(QString text READ text CONSTANT)
29
30 /**
31 * A string if the data stored in the object is HTML (MIME type text/html); otherwise returns an empty string.
32 */
33 Q_PROPERTY(QString html READ html CONSTANT)
34
35 /**
36 * Url contained in the mimedata
37 */
38 Q_PROPERTY(QUrl url READ url CONSTANT)
39
40 /**
41 * A list of URLs contained within the MIME data object.
42 * URLs correspond to the MIME type text/uri-list.
43 */
45
46 /**
47 * A color if the data stored in the object represents a color (MIME type application/x-color); otherwise QVariant().
48 */
50
51 /**
52 * The graphical item on the scene that started the drag event. It may be null.
53 */
55
56 /**
57 * Mimetypes provided by the mime data instance
58 *
59 * @sa QMimeData::formats
60 */
62
63 /**
64 * @sa QMimeData::hasUrls
65 */
66 Q_PROPERTY(bool hasUrls READ hasUrls CONSTANT)
67
68 /**
69 * @returns the wrapped object
70 */
72
73public:
75
76 QString text() const;
77 QString html() const;
78 QUrl url() const;
79 QJsonArray urls() const;
80 bool hasUrls() const;
81 QVariant color() const;
82 QStringList formats() const;
83 QVariant source() const;
84 QMimeData *mimeData() const;
85
86 Q_INVOKABLE QByteArray getDataAsByteArray(const QString &format);
87
88private:
89 const QMimeData *m_data;
90};
91
92#endif
Exposes a const QMimeData instance.
QMimeData * mimeData
QUrl url
Url contained in the mimedata.
QString text
A plain text (MIME type text/plain) representation of the data.
QStringList formats
Mimetypes provided by the mime data instance.
QString html
A string if the data stored in the object is HTML (MIME type text/html); otherwise returns an empty s...
QVariant source
The graphical item on the scene that started the drag event.
QVariant color
A color if the data stored in the object represents a color (MIME type application/x-color); otherwis...
QJsonArray urls
A list of URLs contained within the MIME data object.
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:16:59 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.