emscripten-core / emscripten-core/emscripten

`emscripten_set_mousedown_callback` does not call the callback function from Qt Creator

Open
#22,133 40 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

The next example works without problems when I compile and run it from the command line: `emcc -g main.cpp -o public/index.html` But when I create `Empty qmake Project` from Qt Creater and run it - it doesn't work - it does not print "Mouse down" to the console:

main.cpp

```cpp
#include
#include
#include

// 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;
});
}
```

I create a project in Qt Creator like this:

![image](https://github.com/emscripten-core/emscripten/assets/3908473/e68d3483-8bf0-41a7-bbb6-d620c6ca227c)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.