KDeclarative

DeclarativeMimeData.h
1/*
2 SPDX-FileCopyrightText: 2010 BetterInbox <contact@betterinbox.com>
3 SPDX-FileContributor: Gregory Schlomoff <greg@betterinbox.com>
4
5 SPDX-License-Identifier: MIT
6*/
7
8#ifndef DECLARATIVEMIMEDATA_H
9#define DECLARATIVEMIMEDATA_H
10
11#include <QColor>
12#include <QJsonArray>
13#include <QMimeData>
14#include <QQuickItem>
15#include <QUrl>
16
18{
20
21 /**
22 * A plain text (MIME type text/plain) representation of the data.
23 */
24 Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
25
26 /**
27 * A string if the data stored in the object is HTML (MIME type text/html); otherwise returns an empty string.
28 */
29 Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged)
30
31 /**
32 * Url contained in the mimedata
33 */
34 Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
35
36 /**
37 * A list of URLs contained within the MIME data object.
38 * URLs correspond to the MIME type text/uri-list.
39 */
40 Q_PROPERTY(QJsonArray urls READ urls WRITE setUrls NOTIFY urlsChanged)
41
42 /**
43 * A color if the data stored in the object represents a color (MIME type application/x-color); otherwise QColor().
44 */
45 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
46
47 /**
48 * The graphical item on the scene that started the drag event. It may be null.
49 */
50 Q_PROPERTY(QQuickItem *source READ source WRITE setSource NOTIFY sourceChanged)
51
52 /** @see QMimeData::hasUrls */
53 Q_PROPERTY(bool hasUrls READ hasUrls NOTIFY urlsChanged)
54 // TODO: Image property
55
56 /**
57 * @sa QMimeData::formats
58 */
60public:
62 DeclarativeMimeData(const QMimeData *copy);
63
64 QUrl url() const;
65 void setUrl(const QUrl &url);
66
67 QJsonArray urls() const;
68 void setUrls(const QJsonArray &urls);
69
70 QColor color() const;
71 void setColor(const QColor &color);
72 Q_INVOKABLE bool hasColor() const;
73
74 Q_INVOKABLE void setData(const QString &mimeType, const QVariant &data);
75
76 QQuickItem *source() const;
77 void setSource(QQuickItem *source);
78
79 Q_INVOKABLE QByteArray getDataAsByteArray(const QString &format);
80
81 /*
82 QString text() const; //TODO: Reimplement this to issue the onChanged signals
83 void setText(const QString &text);
84 QString html() const;
85 void setHtml(const QString &html);
86 */
87
89 void textChanged(); // FIXME not being used
90 void htmlChanged(); // FIXME not being used
91 void urlChanged();
92 void urlsChanged();
93 void colorChanged();
94 void sourceChanged();
95
96private:
97 QQuickItem *m_source;
98};
99
100#endif // DECLARATIVEMIMEDATA_H
QString html
A string if the data stored in the object is HTML (MIME type text/html); otherwise returns an empty s...
QJsonArray urls
A list of URLs contained within the MIME data object.
QString text
A plain text (MIME type text/plain) representation of the data.
QUrl url
Url contained in the mimedata.
QColor color
A color if the data stored in the object represents a color (MIME type application/x-color); otherwis...
QQuickItem * source
The graphical item on the scene that started the drag event.
QByteArray data(const QString &mimeType) const const
void setHtml(const QString &html)
void setText(const QString &text)
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:14:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.