8#include <QtCore/private/qmakearray_p.h>
9#include <QtCore/private/qstringiterator_p.h>
10#include <QtCore/qregularexpression.h>
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)
103 const auto code =
event[
"code"].as<std::string>();
104 const auto webKey =
event[
"key"].as<std::string>();
105 deadKey = isDeadKeyEvent(webKey.c_str());
128 const auto eventType = ([&
event]() -> std::optional<EventType> {
129 const auto eventTypeString =
event[
"type"].as<std::string>();
131 if (eventTypeString ==
"keydown")
133 else if (eventTypeString ==
"keyup")
174 pointerId =
event[
"pointerId"].as<
int>();
185 isPrimary =
event[
"isPrimary"].as<
bool>();
200 const auto eventType = ([&
event]() -> std::optional<EventType> {
201 const auto eventTypeString =
event[
"type"].as<std::string>();
203 if (eventTypeString ==
"pointermove")
205 else if (eventTypeString ==
"pointerup")
207 else if (eventTypeString ==
"pointerdown")
209 else if (eventTypeString ==
"pointerenter")
211 else if (eventTypeString ==
"pointerleave")
225 const std::string
effect =
event[
"dataTransfer"][
"dropEffect"].as<std::string>();
229 else if (
effect ==
"move")
231 else if (
effect ==
"link")
249 const auto eventType = ([&
event]() -> std::optional<EventType> {
250 const auto eventTypeString =
event[
"type"].as<std::string>();
252 if (eventTypeString ==
"drop")
264 const int deltaMode =
event[
"deltaMode"].as<
int>();
265 const auto jsWheelEventType = emscripten::val::global(
"WheelEvent");
266 if (
deltaMode == jsWheelEventType[
"DOM_DELTA_PIXEL"].as<int>())
268 else if (
deltaMode == jsWheelEventType[
"DOM_DELTA_LINE"].as<int>())
290 const auto eventType = ([&
event]() -> std::optional<EventType> {
291 const auto eventTypeString =
event[
"type"].as<std::string>();
293 if (eventTypeString ==
"wheel")
\inmodule QtCore\reentrant
\inmodule QtCore \reentrant
QRegularExpressionMatch match(const QString &subject, qsizetype offset=0, MatchType matchType=NormalMatch, MatchOptions matchOptions=NoMatchOption) const
Attempts to match the regular expression against the given subject string, starting at the position o...
\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
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...
QString toUpper() const &
qsizetype length() const
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 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)
static std::optional< DragEvent > fromWeb(emscripten::val webEvent)
DragEvent(EventType type, emscripten::val webEvent)
Qt::DropAction dropAction
Event(EventType type, emscripten::val target)
Event & operator=(const Event &other)
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)