8#include <QtCore/private/qmakearray_p.h>
9#include <QtCore/private/qstringiterator_p.h>
10#include <QtCore/qregularexpression.h>
29 const auto match = regex.match(codeQString);
31 if (!
match.hasMatch())
34 constexpr size_t CharacterIndex = 1;
35 return static_cast<Qt::Key>(
match.capturedView(CharacterIndex).at(0).toLatin1());
38Qt::Key webKeyToQtKey(
const std::string &code,
const std::string &
key,
bool isDeadKey,
42 auto mapped = getKeyFromCode(code);
74 return static_cast<Qt::Key>(
i.next(0));
82 const EmscriptenKeyboardEvent&
event)
106 const auto code =
event[
"code"].as<std::string>();
107 const auto webKey =
event[
"key"].as<std::string>();
108 deadKey = isDeadKeyEvent(webKey.c_str());
134 const auto eventType = ([&
event]() -> std::optional<EventType> {
135 const auto eventTypeString =
event[
"type"].as<std::string>();
137 if (eventTypeString ==
"keydown")
139 else if (eventTypeString ==
"keyup")
180 pointerId =
event[
"pointerId"].as<
int>();
197 isPrimary =
event[
"isPrimary"].as<
bool>();
212 const auto eventType = ([&
event]() -> std::optional<EventType> {
213 const auto eventTypeString =
event[
"type"].as<std::string>();
215 if (eventTypeString ==
"pointermove")
217 else if (eventTypeString ==
"pointerup")
219 else if (eventTypeString ==
"pointerdown")
221 else if (eventTypeString ==
"pointerenter")
223 else if (eventTypeString ==
"pointerleave")
237 const std::string
effect =
event[
"dataTransfer"][
"dropEffect"].as<std::string>();
241 else if (
effect ==
"move")
243 else if (
effect ==
"link")
261 const auto eventType = ([&
event]() -> std::optional<EventType> {
262 const auto eventTypeString =
event[
"type"].as<std::string>();
264 if (eventTypeString ==
"dragend")
266 if (eventTypeString ==
"dragover")
268 if (eventTypeString ==
"dragstart")
270 if (eventTypeString ==
"drop")
282 webEvent.call<
void>(
"preventDefault");
288 webEvent.call<
void>(
"preventDefault");
294 webEvent.call<
void>(
"preventDefault");
300 const int deltaMode =
event[
"deltaMode"].as<
int>();
301 const auto jsWheelEventType = emscripten::val::global(
"WheelEvent");
302 if (
deltaMode == jsWheelEventType[
"DOM_DELTA_PIXEL"].as<int>())
304 else if (
deltaMode == jsWheelEventType[
"DOM_DELTA_LINE"].as<int>())
326 const auto eventType = ([&
event]() -> std::optional<EventType> {
327 const auto eventTypeString =
event[
"type"].as<std::string>();
329 if (eventTypeString ==
"wheel")
\inmodule QtCore\reentrant
\inmodule QtCore \reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromStdString(const std::string &s)
void clear()
Clears the contents of the string and makes it null.
qsizetype size() const noexcept
Returns the number of characters in this string.
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
qsizetype length() const noexcept
Returns the number of characters in this string.
void applyDeadKeyTranslations(KeyEvent *event)
EGLImageKHR int int EGLuint64KHR * modifiers
QFlags< Qt::KeyboardModifier > getForEvent< EmscriptenKeyboardEvent >(const EmscriptenKeyboardEvent &event)
QFlags< Qt::KeyboardModifier > getForEvent(const Event &event)
Combined button and popup list for selecting options.
constexpr std::string_view WebDeadKeyValue
bool isDeadKeyEvent(const char *key)
Qt::Key getKeyFromCode(const std::string &code)
std::optional< Qt::Key > mapWebKeyTextToQtKey(const char *toFind)
int qstrncmp(const char *str1, const char *str2, size_t len)
GLint GLsizei GLsizei height
GLenum GLenum GLenum GLenum mapping
#define Q_ASSERT_X(cond, x, msg)
#define QStringLiteral(str)
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
QGraphicsOpacityEffect * effect
the effect attached to this item
DragEvent & operator=(const DragEvent &other)
DragEvent(EventType type, emscripten::val webEvent, QWindow *targetQWindow)
static std::optional< DragEvent > fromWeb(emscripten::val webEvent, QWindow *targetQWindow)
Qt::DropAction dropAction
Event & operator=(const Event &other)
Event(EventType type, emscripten::val webEvent)
KeyEvent & operator=(const KeyEvent &other)
static std::optional< KeyEvent > fromWebWithDeadKeyTranslation(emscripten::val webEvent, QWasmDeadKeySupport *deadKeySupport)
KeyEvent(EventType type, emscripten::val webEvent)
static constexpr Qt::MouseButton buttonFromWeb(int webButton)
Qt::MouseButton mouseButton
static constexpr Qt::MouseButtons buttonsFromWeb(unsigned short webButtons)
Qt::MouseButtons mouseButtons
MouseEvent(EventType type, emscripten::val webEvent)
MouseEvent & operator=(const MouseEvent &other)
PointerEvent(EventType type, emscripten::val webEvent)
static std::optional< PointerEvent > fromWeb(emscripten::val webEvent)
PointerEvent & operator=(const PointerEvent &other)
static std::optional< WheelEvent > fromWeb(emscripten::val webEvent)
WheelEvent(EventType type, emscripten::val webEvent)
bool webkitDirectionInvertedFromDevice
WheelEvent & operator=(const WheelEvent &other)