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
qwasmdrag.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWINDOWSDRAG_H
5#define QWINDOWSDRAG_H
6
7#include <private/qstdweb_p.h>
8#include <private/qsimpledrag_p.h>
9
10#include <qpa/qplatformdrag.h>
11#include <QtGui/qdrag.h>
12
13#include <memory>
14
15QT_BEGIN_NAMESPACE
16
17struct DragEvent;
18
19class QWasmScreen;
20class QWasmDrag final : public QSimpleDrag
21{
22public:
25 QWasmDrag(const QWasmDrag &other) = delete;
26 QWasmDrag(QWasmDrag &&other) = delete;
27 QWasmDrag &operator=(const QWasmDrag &other) = delete;
28 QWasmDrag &operator=(QWasmDrag &&other) = delete;
29
30 static QWasmDrag *instance();
31
32 void onNativeDragOver(DragEvent *event);
33 void onNativeDrop(DragEvent *event);
34 void onNativeDragStarted(DragEvent *event);
35 void onNativeDragFinished(DragEvent *event, QWasmScreen *platformScreen);
36 void onNativeDragEnter(DragEvent *event);
37 void onNativeDragLeave(DragEvent *event);
38
39 // QPlatformDrag:
40 Qt::DropAction drag(QDrag *drag) final;
41
42private:
43 struct DragState;
44 bool m_isInEnterDrag = false;
45 std::shared_ptr<DragState> m_dragState;
46};
47
48QT_END_NAMESPACE
49
50#endif // QWINDOWSDRAG_H
\inmodule QtCore\reentrant
Definition qpoint.h:30
DragImage(const QPixmap &pixmap, const QMimeData *mimeData, QWindow *window)
emscripten::val htmlElement()
Definition qwasmdrag.cpp:58
QWasmDrag(QWasmDrag &&other)=delete
QWasmDrag & operator=(QWasmDrag &&other)=delete
Qt::DropAction drag(QDrag *drag) final
Definition qwasmdrag.cpp:95
void onNativeDrop(DragEvent *event)
QWasmDrag(const QWasmDrag &other)=delete
void onNativeDragEnter(DragEvent *event)
void onNativeDragLeave(DragEvent *event)
QWasmDrag & operator=(const QWasmDrag &other)=delete
void onNativeDragOver(DragEvent *event)
~QWasmDrag() override
static QWasmDrag * instance()
Definition qwasmdrag.cpp:90
void onNativeDragStarted(DragEvent *event)
void onNativeDragFinished(DragEvent *event, QWasmScreen *platformScreen)
static QWasmIntegration * get()
emscripten::val element() const
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
static QWasmWindow * fromWindow(const QWindow *window)
friend class QWasmCompositor
QWasmScreen * platformScreen() const
Combined button and popup list for selecting options.
QWindow * windowForDrag(QDrag *drag)
Definition qwasmdrag.cpp:33
Definition qwasmdom.h:29
EventType
Definition qwasmevent.h:22
void acceptDrop()
void acceptDragOver()
void cancelDragStart()
QWindow * targetWindow
Definition qwasmevent.h:151
DragState(QWasmDrag &&other)=delete
std::function< void()> quitEventLoopClosure
Definition qwasmdrag.cpp:81
DragState(QDrag *drag, QWindow *window, std::function< void()> quitEventLoopClosure)
std::unique_ptr< DragImage > dragImage
Definition qwasmdrag.cpp:82
Qt::DropAction dropAction
Definition qwasmdrag.cpp:83
DragState(const QWasmDrag &other)=delete
DragState & operator=(QWasmDrag &&other)=delete
DragState & operator=(const QWasmDrag &other)=delete