diff --git a/src/plugins/platforms/wasm/CMakeLists.txt b/src/plugins/platforms/wasm/CMakeLists.txt index 7b2d79ce587..b00684a1378 100644 --- a/src/plugins/platforms/wasm/CMakeLists.txt +++ b/src/plugins/platforms/wasm/CMakeLists.txt @@ -33,7 +33,6 @@ qt_internal_add_plugin(QWasmIntegrationPlugin qwasmwindownonclientarea.cpp qwasmwindownonclientarea.h qwasminputcontext.cpp qwasminputcontext.h qwasmwindowstack.cpp qwasmwindowstack.h - qwasmdrag.cpp qwasmdrag.h DEFINES QT_EGL_NO_X11 QT_NO_FOREACH @@ -67,6 +66,11 @@ qt_internal_extend_target(QWasmIntegrationPlugin CONDITION QT_FEATURE_clipboard qwasmclipboard.cpp qwasmclipboard.h ) +qt_internal_extend_target(QWasmIntegrationPlugin CONDITION QT_FEATURE_draganddrop + SOURCES + qwasmdrag.cpp qwasmdrag.h +) + qt_internal_extend_target(QWasmIntegrationPlugin CONDITION QT_FEATURE_opengl SOURCES qwasmbackingstore.cpp qwasmbackingstore.h diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp index 08092f2cccc..7b4b0421204 100644 --- a/src/plugins/platforms/wasm/qwasmintegration.cpp +++ b/src/plugins/platforms/wasm/qwasmintegration.cpp @@ -16,7 +16,9 @@ #include "qwasmwindow.h" #include "qwasmbackingstore.h" #include "qwasmfontdatabase.h" +#if QT_CONFIG(draganddrop) #include "qwasmdrag.h" +#endif #include #include @@ -31,7 +33,9 @@ // this is where EGL headers are pulled in, make sure it is last #include "qwasmscreen.h" +#if QT_CONFIG(draganddrop) #include +#endif QT_BEGIN_NAMESPACE @@ -148,7 +152,9 @@ QWasmIntegration::QWasmIntegration() visualViewport.call("addEventListener", val("resize"), val::module_property("qtResizeAllScreens")); } +#if QT_CONFIG(draganddrop) m_drag = std::make_unique(); +#endif } QWasmIntegration::~QWasmIntegration() diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp index d0cc773cfed..e3e5f064811 100644 --- a/src/plugins/platforms/wasm/qwasmwindow.cpp +++ b/src/plugins/platforms/wasm/qwasmwindow.cpp @@ -23,7 +23,9 @@ #include "qwasmevent.h" #include "qwasmeventdispatcher.h" #include "qwasmaccessibility.h" +#if QT_CONFIG(draganddrop) #include "qwasmdrag.h" +#endif #include #include @@ -143,6 +145,7 @@ void QWasmWindow::registerEventHandlers() [this](emscripten::val event) { this->handlePointerEnterLeaveEvent(PointerEvent(EventType::PointerLeave, event)); } ); +#if QT_CONFIG(draganddrop) m_window.call("setAttribute", emscripten::val("draggable"), emscripten::val("true")); m_dragStartCallback = QWasmEventHandler(m_window, "dragstart", [this](emscripten::val event) { @@ -174,6 +177,7 @@ void QWasmWindow::registerEventHandlers() QWasmDrag::instance()->onNativeDragLeave(&dragEvent); } ); +#endif // QT_CONFIG(draganddrop) m_wheelEventCallback = QWasmEventHandler(m_window, "wheel", [this](emscripten::val event) { this->handleWheelEvent(event); });