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 QDND_P_H
5#define QDND_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 for the convenience
12// of other Qt classes. 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 <QtGui/private/qtguiglobal_p.h>
19#include "QtCore/qobject.h"
20#include "QtCore/qmap.h"
21#include "QtCore/qmimedata.h"
22#include "QtGui/qdrag.h"
23#include "QtGui/qpixmap.h"
24#include "QtGui/qcursor.h"
25#include "QtGui/qwindow.h"
26#include "QtCore/qpoint.h"
27#include "private/qobject_p.h"
28#include "QtGui/qbackingstore.h"
29
30QT_REQUIRE_CONFIG(draganddrop);
31
32QT_BEGIN_NAMESPACE
33
34class QPlatformDrag;
35
36class QDragPrivate : public QObjectPrivate
37{
38public:
39 QDragPrivate()
40 : source(nullptr)
41 , target(nullptr)
42 , data(nullptr)
43 { }
44 QObject *source;
45 QObject *target;
46 QMimeData *data;
47 QPixmap pixmap;
48 QPoint hotspot;
49 Qt::DropAction executed_action;
50 Qt::DropActions supported_actions;
51 Qt::DropAction default_action;
52 QMap<Qt::DropAction, QPixmap> customCursors;
53};
54
55class Q_GUI_EXPORT QDragManager : public QObject {
56 Q_OBJECT
57
58public:
59 QDragManager();
60 ~QDragManager();
61 static QDragManager *self();
62
63 Qt::DropAction drag(QDrag *);
64
65 void setCurrentTarget(QObject *target, bool dropped = false);
66 QObject *currentTarget() const;
67
68 QPointer<QDrag> object() const { return m_object; }
69 QObject *source() const;
70
71private:
72 QObject *m_currentDropTarget;
73 QPlatformDrag *m_platformDrag;
74 QPointer<QDrag> m_object;
75
76 static QDragManager *m_instance;
77 Q_DISABLE_COPY_MOVE(QDragManager)
78};
79
80QT_END_NAMESPACE
81
82#endif // QDND_P_H
83

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