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 QDRAG_H
5#define QDRAG_H
6
7#include <QtGui/qtguiglobal.h>
8#include <QtCore/qobject.h>
9
10QT_REQUIRE_CONFIG(draganddrop);
11
12QT_BEGIN_NAMESPACE
13
14class QMimeData;
15class QDragPrivate;
16class QPixmap;
17class QPoint;
18class QDragManager;
19
20
21class Q_GUI_EXPORT QDrag : public QObject
22{
23 Q_OBJECT
24 Q_DECLARE_PRIVATE(QDrag)
25public:
26 explicit QDrag(QObject *dragSource);
27 ~QDrag();
28
29 void setMimeData(QMimeData *data);
30 QMimeData *mimeData() const;
31
32 void setPixmap(const QPixmap &);
33 QPixmap pixmap() const;
34
35 void setHotSpot(const QPoint &hotspot);
36 QPoint hotSpot() const;
37
38 QObject *source() const;
39 QObject *target() const;
40
41 Qt::DropAction exec(Qt::DropActions supportedActions = Qt::MoveAction);
42 Qt::DropAction exec(Qt::DropActions supportedActions, Qt::DropAction defaultAction);
43
44 void setDragCursor(const QPixmap &cursor, Qt::DropAction action);
45 QPixmap dragCursor(Qt::DropAction action) const;
46
47 Qt::DropActions supportedActions() const;
48 Qt::DropAction defaultAction() const;
49
50 static void cancel();
51
52Q_SIGNALS:
53 void actionChanged(Qt::DropAction action);
54 void targetChanged(QObject *newTarget);
55
56private:
57 friend class QDragManager;
58 Q_DISABLE_COPY(QDrag)
59};
60
61QT_END_NAMESPACE
62
63#endif // QDRAG_H
64

source code of qtbase/src/gui/kernel/qdrag.h