Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylanddrag.cpp
Go to the documentation of this file.
1
// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qwaylanddrag.h"
6
7
#
include
<
private
/
qobject_p
.
h
>
8
9
#
include
"qwaylandview.h"
10
#
include
<
QtWaylandCompositor
/
private
/
qwaylandseat_p
.
h
>
11
#
include
<
QtWaylandCompositor
/
private
/
qtwaylandcompositorglobal_p
.
h
>
12
13
#
if
QT_CONFIG
(
wayland_datadevice
)
14
#
include
"qwldatadevice_p.h"
15
#
endif
16
17
QT_BEGIN_NAMESPACE
18
19
class
QWaylandDragPrivate
:
public
QObjectPrivate
20
{
21
public
:
22
QWaylandDragPrivate
(QWaylandSeat *seat)
23
:
seat
(seat)
24
{
25
}
26
27
QtWayland
::
DataDevice
*
dataDevice
()
28
{
29
return
QWaylandSeatPrivate::get(seat)->dataDevice();
30
}
31
32
const
QtWayland
::
DataDevice
*
dataDevice
()
const
33
{
34
return
QWaylandSeatPrivate::get(seat)->dataDevice();
35
}
36
37
QWaylandSeat *
seat
=
nullptr
;
38
};
39
40
QWaylandDrag::QWaylandDrag(QWaylandSeat *seat)
41
: QObject(*
new
QWaylandDragPrivate(seat))
42
{
43
}
44
45
/*!
46
* \qmlproperty WaylandSurface QtWayland.Compositor::WaylandDrag::icon
47
*
48
* This property holds the surface representing the icon of the drag operation,
49
* or \c null if no icon has been set.
50
*/
51
52
/*!
53
* \property QWaylandDrag::icon
54
*
55
* This property holds the surface representing the icon of the drag operation,
56
* or \nullptr if no icon has been set.
57
*/
58
QWaylandSurface *QWaylandDrag::icon()
const
59
{
60
Q_D(
const
QWaylandDrag);
61
62
const
QtWayland::DataDevice *dataDevice = d->dataDevice();
63
if
(!dataDevice)
64
return
nullptr
;
65
66
return
dataDevice->dragIcon();
67
}
68
69
QWaylandSurface *QWaylandDrag::origin()
const
70
{
71
Q_D(
const
QWaylandDrag);
72
const
QtWayland::DataDevice *dataDevice = d->dataDevice();
73
return
dataDevice ? dataDevice->dragOrigin() :
nullptr
;
74
}
75
76
QWaylandSeat *QWaylandDrag::seat()
const
77
{
78
Q_D(
const
QWaylandDrag);
79
return
d->seat;
80
}
81
82
/*!
83
* \qmlproperty bool QtWayland.Compositor::WaylandDrag::visible
84
*
85
* This property holds whether the drag operation has an icon.
86
*
87
* The value is \c true if an icon has been set for the drag operation;
88
* otherwise \c false.
89
*/
90
91
/*!
92
* \property QWaylandDrag::visible
93
*
94
* This property holds whether the drag operation has an icon.
95
*
96
* The value is \c true if an icon has been set for the drag operation;
97
* otherwise \c false.
98
*/
99
bool
QWaylandDrag::visible()
const
100
{
101
Q_D(
const
QWaylandDrag);
102
103
const
QtWayland::DataDevice *dataDevice = d->dataDevice();
104
if
(!dataDevice)
105
return
false
;
106
107
return
dataDevice->dragIcon() !=
nullptr
;
108
}
109
110
void
QWaylandDrag::dragMove(QWaylandSurface *target,
const
QPointF &pos)
111
{
112
Q_D(QWaylandDrag);
113
QtWayland::DataDevice *dataDevice = d->dataDevice();
114
if
(!dataDevice)
115
return
;
116
dataDevice->dragMove(target, pos);
117
}
118
void
QWaylandDrag::drop()
119
{
120
Q_D(QWaylandDrag);
121
QtWayland::DataDevice *dataDevice = d->dataDevice();
122
if
(!dataDevice)
123
return
;
124
dataDevice->drop();
125
}
126
127
void
QWaylandDrag::cancelDrag()
128
{
129
Q_D(QWaylandDrag);
130
QtWayland::DataDevice *dataDevice = d->dataDevice();
131
if
(!dataDevice)
132
return
;
133
dataDevice->cancelDrag();
134
}
135
136
QT_END_NAMESPACE
137
138
#
include
"moc_qwaylanddrag.cpp"
QWaylandDragPrivate
Definition
qwaylanddrag.cpp:20
QWaylandDragPrivate::dataDevice
const QtWayland::DataDevice * dataDevice() const
Definition
qwaylanddrag.cpp:32
QWaylandDragPrivate::dataDevice
QtWayland::DataDevice * dataDevice()
Definition
qwaylanddrag.cpp:27
QWaylandDragPrivate::QWaylandDragPrivate
QWaylandDragPrivate(QWaylandSeat *seat)
Definition
qwaylanddrag.cpp:22
QWaylandDragPrivate::seat
QWaylandSeat * seat
Definition
qwaylanddrag.cpp:37
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtwayland
src
compositor
compositor_api
qwaylanddrag.cpp
Generated on
for Qt by
1.16.1