emscripten_set_mousedown_callback does not call the callback function
Unsolved
Qt for WebAssembly
-
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(); }
-
Bug report: https://bugreports.qt.io/browse/QTBUG-126582
-
8 8Observer8 referenced this topic on
-
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
-
This post is deleted!
-
This post is deleted!
-
The Emscripten issue: emscripten_set_mousedown_callback does not call the callback function from Qt Creator