diff options
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmdrag.h')
-rw-r--r-- | src/plugins/platforms/wasm/qwasmdrag.h | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/src/plugins/platforms/wasm/qwasmdrag.h b/src/plugins/platforms/wasm/qwasmdrag.h index 6358b415c3..146a69ebe8 100644 --- a/src/plugins/platforms/wasm/qwasmdrag.h +++ b/src/plugins/platforms/wasm/qwasmdrag.h @@ -1,43 +1,47 @@ -// Copyright (C) 2022 The Qt Company Ltd. +// Copyright (C) 2023 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -#ifndef QWASMDRAG_H -#define QWASMDRAG_H +#ifndef QWINDOWSDRAG_H +#define QWINDOWSDRAG_H -#include <qpa/qplatformdrag.h> -#include <private/qsimpledrag_p.h> #include <private/qstdweb_p.h> -#include <QDrag> -#include "qwasmscreen.h" +#include <private/qsimpledrag_p.h> + +#include <qpa/qplatformdrag.h> +#include <QtGui/qdrag.h> -QT_REQUIRE_CONFIG(draganddrop); +#include <memory> QT_BEGIN_NAMESPACE -class QWasmDrag : public QSimpleDrag +struct DragEvent; + +class QWasmDrag final : public QSimpleDrag { public: - QWasmDrag(); - ~QWasmDrag(); + ~QWasmDrag() override; + QWasmDrag(const QWasmDrag &other) = delete; + QWasmDrag(QWasmDrag &&other) = delete; + QWasmDrag &operator=(const QWasmDrag &other) = delete; + QWasmDrag &operator=(QWasmDrag &&other) = delete; + + static QWasmDrag *instance(); - void drop(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) override; - void move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) override; + void onNativeDragOver(DragEvent *event); + void onNativeDrop(DragEvent *event); + void onNativeDragStarted(DragEvent *event); + void onNativeDragFinished(DragEvent *event); - Qt::MouseButton m_qButton; - QPoint m_mouseDropPoint; - QFlags<Qt::KeyboardModifier> m_keyModifiers; - Qt::DropActions m_dropActions; - QWasmScreen *m_wasmScreen = nullptr; - int m_mimeTypesCount = 0; - QMimeData *m_mimeData = nullptr; - void qWasmDrop(); + // QPlatformDrag: + Qt::DropAction drag(QDrag *drag) final; private: - void init(); -}; + struct DragState; + std::unique_ptr<DragState> m_dragState; +}; QT_END_NAMESPACE -#endif // QWASMDRAG_H +#endif // QWINDOWSDRAG_H |