diff options
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmintegration.cpp')
-rw-r--r-- | src/plugins/platforms/wasm/qwasmintegration.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp index fa4ae981bb..090218a118 100644 --- a/src/plugins/platforms/wasm/qwasmintegration.cpp +++ b/src/plugins/platforms/wasm/qwasmintegration.cpp @@ -80,6 +80,12 @@ QWasmIntegration::QWasmIntegration() m_clipboard(new QWasmClipboard), m_accessibility(new QWasmAccessibility) { + // Temporary measure to make dropEvent appear in the library. EMSCRIPTEN_KEEPALIVE does not + // work, nor does a Q_CONSTRUCTOR_FUNCTION in qwasmdrag.cpp. + volatile bool foolEmcc = false; + if (foolEmcc) + dropEvent(emscripten::val::undefined()); + s_instance = this; touchPoints = emscripten::val::global("navigator")["maxTouchPoints"].as<int>(); @@ -121,7 +127,7 @@ QWasmIntegration::QWasmIntegration() visualViewport.call<void>("addEventListener", val("resize"), val::module_property("qtResizeAllScreens")); } - m_drag = new QWasmDrag(); + m_drag = std::make_unique<QSimpleDrag>(); } QWasmIntegration::~QWasmIntegration() @@ -138,7 +144,6 @@ QWasmIntegration::~QWasmIntegration() delete m_desktopServices; if (m_platformInputContext) delete m_platformInputContext; - delete m_drag; delete m_accessibility; for (const auto &elementAndScreen : m_screens) @@ -330,7 +335,7 @@ quint64 QWasmIntegration::getTimestamp() #if QT_CONFIG(draganddrop) QPlatformDrag *QWasmIntegration::drag() const { - return m_drag; + return m_drag.get(); } #endif // QT_CONFIG(draganddrop) |