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