emscripten_set_mousedown_callback does not call the callback function
Unsolved
Qt for WebAssembly
-
wrote on 21 Jun 2024, 16:30 last edited by 8Observer8
emscripten_set_mousedown_callback does not call the callback function. I expect to see the output in the console but I see nothing:
#include <QtWidgets/QApplication> #include <QtWidgets/QWidget> #include <emscripten.h> #include <emscripten/html5.h> class Widget : public QWidget { public: Widget() { emscripten_set_mousedown_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, nullptr, 0, +[](int eventType, const EmscriptenMouseEvent* e, void* userData) -> EM_BOOL { qDebug() << "Mouse down: " << e->button; return EM_FALSE; }); } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); Widget w; w.show(); return app.exec(); }
-
wrote on 21 Jun 2024, 16:35 last edited by
Bug report: https://bugreports.qt.io/browse/QTBUG-126582
-
-
wrote on 21 Jun 2024, 17:39 last edited by 8Observer8
I have tried to make an "Empty qmake Project":
pro
wasm: INCLUDEPATH += "C:\emsdk\upstream\emscripten\cache\sysroot\include" SOURCES += \ main.cpp
main.cpp
#include <emscripten.h> #include <emscripten/html5.h> #include <iostream> // https://github.com/emscripten-core/emscripten/issues/19266 int main() { // Mouse Button Down: emscripten_set_mousedown_callback( EMSCRIPTEN_EVENT_TARGET_WINDOW, nullptr, 0, +[](int eventType, const EmscriptenMouseEvent *e, void *userData) -> EM_BOOL { std::cout << "Mouse down: " << e->button << "\n"; return EM_FALSE; }); }
It doesn't print the output to the console when I click.
But it works when I compile from the console:
emcc -g main.cpp -o public/index.html
-
wrote on 21 Jun 2024, 18:10 last edited by 8Observer8This post is deleted!
-
wrote on 22 Jun 2024, 21:00 last edited by 8Observer8This post is deleted!
-
wrote on 22 Jun 2024, 21:08 last edited by 8Observer8
The Emscripten issue: emscripten_set_mousedown_callback does not call the callback function from Qt Creator
1/6