Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickdroparea_p.h
Go to the documentation of this file.
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 QQUICKDROPAREA_P_H
5#define QQUICKDROPAREA_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <private/qtquickglobal_p.h>
19
20#include <QtQuick/qquickitem.h>
21
22#include <QtGui/qevent.h>
23
24QT_REQUIRE_CONFIG(quick_draganddrop);
25
27
30{
32 Q_PROPERTY(qreal x READ x FINAL)
33 Q_PROPERTY(qreal y READ y FINAL)
37 Q_PROPERTY(Qt::DropActions proposedAction READ proposedAction FINAL)
38 Q_PROPERTY(Qt::DropAction action READ action WRITE setAction RESET resetAction FINAL)
39 Q_PROPERTY(bool accepted READ accepted WRITE setAccepted FINAL)
40 Q_PROPERTY(bool hasColor READ hasColor FINAL)
41 Q_PROPERTY(bool hasHtml READ hasHtml FINAL)
42 Q_PROPERTY(bool hasText READ hasText FINAL)
43 Q_PROPERTY(bool hasUrls READ hasUrls FINAL)
50 QML_UNCREATABLE("DragEvent is only meant to be created by DropArea")
52public:
54
55 qreal x() const { return event->position().x(); }
56 qreal y() const { return event->position().y(); }
57
58 QObject *source() const;
59
60 Qt::DropActions supportedActions() const { return event->possibleActions(); }
61 Qt::DropActions proposedAction() const { return event->proposedAction(); }
62 Qt::DropAction action() const { return event->dropAction(); }
63 void setAction(Qt::DropAction action) { event->setDropAction(action); }
64 void resetAction() { event->setDropAction(event->proposedAction()); }
65
66 QStringList keys() const;
67
68 bool accepted() const { return event->isAccepted(); }
69 void setAccepted(bool accepted) { event->setAccepted(accepted); }
70
71 bool hasColor() const;
72 bool hasHtml() const;
73 bool hasText() const;
74 bool hasUrls() const;
75 QVariant colorData() const;
76 QString html() const;
77 QString text() const;
78 QList<QUrl> urls() const;
79 QStringList formats() const;
80
84 Q_INVOKABLE void accept();
86
87private:
89 QDropEvent *event;
90};
91
93{
95 Q_PROPERTY(qreal x READ x NOTIFY positionChanged FINAL)
96 Q_PROPERTY(qreal y READ y NOTIFY positionChanged FINAL)
100public:
103
104 qreal x() const;
105 qreal y() const;
106 QObject *source() const;
107
111
112private:
114
115 friend class QQuickDropArea;
117};
118
120class Q_QUICK_EXPORT QQuickDropArea : public QQuickItem
121{
123 Q_PROPERTY(bool containsDrag READ containsDrag NOTIFY containsDragChanged)
124 Q_PROPERTY(QStringList keys READ keys WRITE setKeys NOTIFY keysChanged)
125 Q_PROPERTY(QQuickDropAreaDrag *drag READ drag CONSTANT)
126 QML_NAMED_ELEMENT(DropArea)
128
129public:
132
133 bool containsDrag() const;
134 void setContainsDrag(bool drag);
135
136 QStringList keys() const;
137 void setKeys(const QStringList &keys);
138
140
142 void containsDragChanged();
143 void keysChanged();
145
146 void entered(QQuickDragEvent *drag);
147 void exited();
149 void dropped(QQuickDragEvent *drop);
150
151protected:
152 void dragMoveEvent(QDragMoveEvent *event) override;
153 void dragEnterEvent(QDragEnterEvent *event) override;
154 void dragLeaveEvent(QDragLeaveEvent *event) override;
155 void dropEvent(QDropEvent *event) override;
156
157private:
158 Q_DISABLE_COPY(QQuickDropArea)
159 Q_DECLARE_PRIVATE(QQuickDropArea)
160};
161
163
164#endif // QQUICKDROPAREA_P_H
\inmodule QtCore
Definition qbytearray.h:57
Definition qlist.h:75
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
Qt::DropActions supportedActions() const
Q_INVOKABLE void accept()
qreal x() const
Qt::DropActions proposedAction() const
Qt::DropActions proposedAction
Q_INVOKABLE QByteArray getDataAsArrayBuffer(const QString &format) const
QStringList formats
Qt::DropAction action
void setAction(Qt::DropAction action)
bool accepted() const
Qt::DropActions supportedActions
Q_INVOKABLE QString getDataAsString(const QString &format) const
QList< QUrl > urls
Qt::DropAction action() const
void setAccepted(bool accepted)
qreal y() const
Q_INVOKABLE void acceptProposedAction()
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qurl.h:94
\inmodule QtCore
Definition qvariant.h:65
EGLint EGLint * formats
Combined button and popup list for selecting options.
Definition qcompare.h:63
DropAction
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei GLenum format
GLint y
GLsizei GLsizei GLchar * source
struct _cl_event * event
GLbyte by
#define QML_UNCREATABLE(REASON)
#define QML_ANONYMOUS
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INVOKABLE
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
QStringList keys