diff --git a/src/plugins/platforms/wasm/qwasminputcontext.cpp b/src/plugins/platforms/wasm/qwasminputcontext.cpp index 1eb59aaa7f2..56cb7c032d8 100644 --- a/src/plugins/platforms/wasm/qwasminputcontext.cpp +++ b/src/plugins/platforms/wasm/qwasminputcontext.cpp @@ -231,13 +231,6 @@ static void pasteCallback(emscripten::val event) // propagate to input event (insertFromPaste) } -EMSCRIPTEN_BINDINGS(wasminputcontext_module) { - - function("qtCopyCallback", ©Callback); - function("qtCutCallback", &cutCallback); - function("qtPasteCallback", &pasteCallback); -} - QWasmInputContext::QWasmInputContext() { qCDebug(qLcQpaWasmInputContext) << Q_FUNC_INFO; @@ -266,15 +259,9 @@ QWasmInputContext::QWasmInputContext() m_compositionUpdateCallback = QWasmEventHandler(m_inputElement, "compositionupdate", QWasmInputContext::compositionUpdateCallback); // Clipboard for InputContext - m_inputElement.call("addEventListener", std::string("cut"), - emscripten::val::module_property("qtCutCallback"), - emscripten::val(false)); - m_inputElement.call("addEventListener", std::string("copy"), - emscripten::val::module_property("qtCopyCallback"), - emscripten::val(false)); - m_inputElement.call("addEventListener", std::string("paste"), - emscripten::val::module_property("qtPasteCallback"), - emscripten::val(false)); + m_clipboardCut = QWasmEventHandler(m_inputElement, "cut", cutCallback); + m_clipboardCopy = QWasmEventHandler(m_inputElement, "copy", copyCallback); + m_clipboardPaste = QWasmEventHandler(m_inputElement, "paste", pasteCallback); } QWasmInputContext::~QWasmInputContext() diff --git a/src/plugins/platforms/wasm/qwasminputcontext.h b/src/plugins/platforms/wasm/qwasminputcontext.h index 3c38412adaf..a5b540dae23 100644 --- a/src/plugins/platforms/wasm/qwasminputcontext.h +++ b/src/plugins/platforms/wasm/qwasminputcontext.h @@ -55,6 +55,10 @@ private: void updateInputElement(); private: + QWasmEventHandler m_clipboardCut; + QWasmEventHandler m_clipboardCopy; + QWasmEventHandler m_clipboardPaste; + QString m_preeditString; int m_replaceSize = 0;