KDeclarative

DeclarativeMimeData.h
1 /*
2  SPDX-FileCopyrightText: 2010 BetterInbox <[email protected]>
3  SPDX-FileContributor: Gregory Schlomoff <[email protected]>
4 
5  SPDX-License-Identifier: MIT
6 */
7 
8 #ifndef DECLARATIVEMIMEDATA_H
9 #define DECLARATIVEMIMEDATA_H
10 
11 #include <QMimeData>
12 #include <QColor>
13 #include <QUrl>
14 #include <QQuickItem>
15 #include <QJsonArray>
16 
18 {
19  Q_OBJECT
20 
24  Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
25 
26 
29  Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged)
30 
34  Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
35 
40  Q_PROPERTY(QJsonArray urls READ urls WRITE setUrls NOTIFY urlsChanged)
41 
45  Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
46 
50  Q_PROPERTY(QQuickItem* source READ source WRITE setSource NOTIFY sourceChanged)
51 
53  Q_PROPERTY(bool hasUrls READ hasUrls NOTIFY urlsChanged)
54  //TODO: Image property
55 
60 public:
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 
88 Q_SIGNALS:
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 
96 private:
97  QQuickItem* m_source;
98 };
99 
100 #endif // DECLARATIVEMIMEDATA_H
QByteArray data(const QString &mimeType) const const
Q_SIGNALSQ_SIGNALS
QString text() const const
Q_OBJECTQ_OBJECT
void setText(const QString &text)
Q_PROPERTY(...)
bool hasUrls() const const
Q_INVOKABLEQ_INVOKABLE
virtual QStringList formats() const const
void setHtml(const QString &html)
QString html() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 22:44:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.