Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwaylanddatadevice_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
5#ifndef QWAYLANDDATADEVICE_H
6#define QWAYLANDDATADEVICE_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
20#include <QObject>
21#include <QPointer>
22#include <QPoint>
23
24#include <QtWaylandClient/private/qwayland-wayland.h>
25
26QT_REQUIRE_CONFIG(wayland_datadevice);
27
29
30class QMimeData;
32class QWindow;
33
34namespace QtWayland {
35class xdg_toplevel_drag_v1;
36}
37
38namespace QtWaylandClient {
39
40class QWaylandDisplay;
41class QWaylandDataDeviceManager;
42class QWaylandDataOffer;
43class QWaylandDataSource;
44class QWaylandInputDevice;
45class QWaylandWindow;
46
47class QWaylandDataDevice : public QObject, public QtWayland::wl_data_device
48{
50public:
52 ~QWaylandDataDevice() override;
53
58
59#if QT_CONFIG(draganddrop)
60 QWaylandDataOffer *dragOffer() const;
61 bool startDrag(QMimeData *mimeData, Qt::DropActions supportedActions, QWaylandWindow *icon);
62 void cancelDrag();
63#endif
64
65protected:
66 void data_device_data_offer(struct ::wl_data_offer *id) override;
67
68#if QT_CONFIG(draganddrop)
69 void data_device_drop() override;
70 void data_device_enter(uint32_t serial, struct ::wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_data_offer *id) override;
71 void data_device_leave() override;
72 void data_device_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y) override;
73#endif
74 void data_device_selection(struct ::wl_data_offer *id) override;
75
76private Q_SLOTS:
77 void selectionSourceCancelled();
78
79#if QT_CONFIG(draganddrop)
80 void dragSourceCancelled();
81#endif
82
83private:
84#if QT_CONFIG(draganddrop)
85 QPoint calculateDragPosition(int x, int y, QWindow *wnd) const;
86#endif
87 void sendResponse(Qt::DropActions supportedActions, const QPlatformDragQtResponse &response);
88
89 static int dropActionsToWl(Qt::DropActions dropActions);
90
91
92 QWaylandDisplay *m_display = nullptr;
93 QWaylandInputDevice *m_inputDevice = nullptr;
94 uint32_t m_enterSerial = 0;
95 QPointer<QWindow> m_dragWindow;
96 QPoint m_dragPoint;
97 QScopedPointer<QWaylandDataOffer> m_dragOffer;
98 QScopedPointer<QWaylandDataOffer> m_selectionOffer;
99 QScopedPointer<QWaylandDataSource> m_selectionSource;
100 QScopedPointer<QWaylandDataSource> m_dragSource;
101 QtWayland::xdg_toplevel_drag_v1 *m_toplevelDrag = nullptr;
102};
103
104}
105
107
108#endif // QWAYLANDDATADEVICE_H
\inmodule QtCore
Definition qmimedata.h:16
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtGui
Definition qwindow.h:63
void data_device_selection(struct ::wl_data_offer *id) override
QWaylandDataSource * selectionSource() const
QWaylandDataOffer * selectionOffer() const
QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWaylandInputDevice *inputDevice)
void setSelectionSource(QWaylandDataSource *source)
void data_device_data_offer(struct ::wl_data_offer *id) override
Combined button and popup list for selecting options.
GLint GLint GLint GLint GLint x
[0]
GLint y
GLsizei GLsizei GLchar * source
#define QT_REQUIRE_CONFIG(feature)
#define Q_OBJECT
#define Q_SLOTS
QMimeData * mimeData
QNetworkAccessManager manager