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
30#include <QtCore/qpointer.h>
31
32QT_REQUIRE_CONFIG(draganddrop);
33
34QT_BEGIN_NAMESPACE
35
36class QPlatformDrag;
37
38class QDragPrivate : public QObjectPrivate
39{
40public:
41 QDragPrivate()
42 : source(nullptr)
43 , target(nullptr)
44 , data(nullptr)
45 { }
46 QObject *source;
47 QObject *target;
48 QMimeData *data;
49 QPixmap pixmap;
50 QPoint hotspot;
51 Qt::DropAction executed_action;
52 Qt::DropActions supported_actions;
53 Qt::DropAction default_action;
54 QMap<Qt::DropAction, QPixmap> customCursors;
55};
56
57class Q_GUI_EXPORT QDragManager : public QObject {
58 Q_OBJECT
59
60public:
61 QDragManager();
62 ~QDragManager();
63 static QDragManager *self();
64
65 Qt::DropAction drag(QDrag *);
66
67 void setCurrentTarget(QObject *target, bool dropped = false);
68 QObject *currentTarget() const;
69
70 QPointer<QDrag> object() const { return m_object; }
71 QObject *source() const;
72
73private:
74 QObject *m_currentDropTarget;
75 QPlatformDrag *m_platformDrag;
76 QPointer<QDrag> m_object;
77
78 static QDragManager *m_instance;
79 Q_DISABLE_COPY_MOVE(QDragManager)
80};
81
82QT_END_NAMESPACE
83
84#endif // QDND_P_H
85

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

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