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 QPLATFORMDRAG_H
5#define QPLATFORMDRAG_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is part of the QPA API and is not meant to be used
12// in applications. Usage of this API may make your code
13// source and binary incompatible with future versions of Qt.
14//
15
16#include <QtGui/qtguiglobal.h>
17#include <QtGui/QPixmap>
18
19QT_REQUIRE_CONFIG(draganddrop);
20
21QT_BEGIN_NAMESPACE
22
23class QMimeData;
24class QMouseEvent;
25class QDrag;
26class QObject;
27class QEvent;
28class QPlatformDragPrivate;
29
30class Q_GUI_EXPORT QPlatformDropQtResponse
31{
32public:
33 QPlatformDropQtResponse(bool accepted, Qt::DropAction acceptedAction);
34 bool isAccepted() const;
35 Qt::DropAction acceptedAction() const;
36
37private:
38 bool m_accepted;
39 Qt::DropAction m_accepted_action;
40
41};
42
43class Q_GUI_EXPORT QPlatformDragQtResponse : public QPlatformDropQtResponse
44{
45public:
46 QPlatformDragQtResponse(bool accepted, Qt::DropAction acceptedAction, QRect answerRect);
47
48 QRect answerRect() const;
49
50private:
51 QRect m_answer_rect;
52};
53
54class Q_GUI_EXPORT QPlatformDrag
55{
56 Q_DECLARE_PRIVATE(QPlatformDrag)
57public:
58 Q_DISABLE_COPY_MOVE(QPlatformDrag)
59
60 QPlatformDrag();
61 virtual ~QPlatformDrag();
62
63 QDrag *currentDrag() const;
64
65 virtual Qt::DropAction drag(QDrag *m_drag) = 0;
66 virtual void cancelDrag();
67 void updateAction(Qt::DropAction action);
68
69 virtual Qt::DropAction defaultAction(Qt::DropActions possibleActions, Qt::KeyboardModifiers modifiers) const;
70
71 static QPixmap defaultPixmap();
72
73 virtual bool ownsDragObject() const;
74
75private:
76 QPlatformDragPrivate *d_ptr;
77};
78
79QT_END_NAMESPACE
80
81#endif
82

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