Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qsimpledrag_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
// Qt-Security score:significant reason:default
4
5
#
ifndef
QSIMPLEDRAG_P_H
6
#
define
QSIMPLEDRAG_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
<
QtGui
/
private
/
qtguiglobal_p
.
h
>
20
#
include
<
qpa
/
qplatformdrag
.
h
>
21
22
#
include
<
QtCore
/
QObject
>
23
#
include
<
QtCore
/
QPointer
>
24
#
include
<
QtGui
/
qdrag
.
h
>
25
#
include
<
QtGui
/
QWindow
>
26
27
QT_REQUIRE_CONFIG
(
draganddrop
);
28
29
QT_BEGIN_NAMESPACE
30
31
class
QMouseEvent;
32
class
QEventLoop;
33
class
QDropData;
34
class
QShapedPixmapWindow;
35
class
QScreen;
36
37
class
Q_GUI_EXPORT
QBasicDrag
:
public
QPlatformDrag,
public
QObject
38
{
39
public
:
40
~QBasicDrag();
41
42
virtual
Qt::DropAction drag(QDrag *drag) override;
43
void
cancelDrag() override;
44
45
virtual
bool
eventFilter(QObject *o, QEvent *e) override;
46
47
protected
:
48
QBasicDrag();
49
50
virtual
void
startDrag();
51
virtual
void
cancel();
52
virtual
void
move(
const
QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) = 0;
53
virtual
void
drop(
const
QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) = 0;
54
virtual
void
endDrag();
55
56
57
void
moveShapedPixmapWindow(
const
QPoint &deviceIndependentPosition);
58
QShapedPixmapWindow *shapedPixmapWindow()
const
{
return
m_drag_icon_window; }
59
void
recreateShapedPixmapWindow(QScreen *screen,
const
QPoint &pos);
60
void
updateCursor(Qt::DropAction action);
61
62
bool
canDrop()
const
{
return
m_can_drop; }
63
void
setCanDrop(
bool
c) { m_can_drop = c; }
64
65
bool
useCompositing()
const
{
return
m_useCompositing; }
66
void
setUseCompositing(
bool
on) { m_useCompositing = on; }
67
68
void
setScreen(QScreen *screen) { m_screen = screen; }
69
70
Qt::DropAction executedDropAction()
const
{
return
m_executed_drop_action; }
71
void
setExecutedDropAction(Qt::DropAction da) { m_executed_drop_action = da; }
72
73
QDrag *drag()
const
{
return
m_drag; }
74
75
protected
:
76
QWindow *m_sourceWindow =
nullptr
;
77
QPointer<QWindow> m_windowUnderCursor =
nullptr
;
78
79
private
:
80
void
enableEventFilter();
81
void
disableEventFilter();
82
void
restoreCursor();
83
void
exitDndEventLoop();
84
85
#
ifndef
QT_NO_CURSOR
86
bool
m_dndHasSetOverrideCursor =
false
;
87
#
endif
88
QEventLoop *m_eventLoop =
nullptr
;
89
Qt::DropAction m_executed_drop_action = Qt::IgnoreAction;
90
bool
m_can_drop =
false
;
91
bool
m_dragEndRequested =
false
;
92
QPointer<QDrag> m_drag;
93
QShapedPixmapWindow *m_drag_icon_window =
nullptr
;
94
bool
m_useCompositing =
true
;
95
QScreen *m_screen =
nullptr
;
96
QPoint m_lastPos;
97
};
98
99
class
Q_GUI_EXPORT
QSimpleDrag
:
public
QBasicDrag
100
{
101
public
:
102
QSimpleDrag();
103
104
protected
:
105
virtual
void
startDrag() override;
106
virtual
void
cancel() override;
107
virtual
void
move(
const
QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) override;
108
virtual
void
drop(
const
QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) override;
109
};
110
111
QT_END_NAMESPACE
112
113
#
endif
QBasicDrag
QBasicDrag is a base class for implementing platform drag and drop.
Definition
qsimpledrag_p.h:38
QPoint
\inmodule QtCore\reentrant
Definition
qpoint.h:30
QSimpleDrag
QSimpleDrag implements QBasicDrag for Drag and Drop operations within the Qt Application itself.
Definition
qsimpledrag_p.h:100
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qApp
#define qApp
Definition
qcoreapplication.h:38
QT_REQUIRE_CONFIG
QT_REQUIRE_CONFIG(draganddrop)
fromNativeGlobalPixels
static QPoint fromNativeGlobalPixels(const QPoint &point)
Definition
qsimpledrag.cpp:333
sendDragLeave
static void sendDragLeave(QWindow *window)
Definition
qsimpledrag.cpp:390
getNativeMousePos
static QPoint getNativeMousePos(QEvent *e, QWindow *window)
Definition
qsimpledrag.cpp:81
qtbase
src
gui
kernel
qsimpledrag_p.h
Generated on
for Qt by
1.18.0