wasm: ignore keypresses if alt and numeric keyboard

When left-alt + num lock activated + number pressed the number
was inserted in the text. However in this input mode a 4 digit
keycode is used to insert a special character, it is wrong to
insert the individual digits in addition

Fixes: QTBUG-136799
Pick-to: 6.9 6.8
Change-Id: Iebafd1dfe5df1701a87a824ed99a440b122f0c57
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Even Oscar Andersen 2025-05-19 06:14:12 +02:00
parent ac710784af
commit 5c82db79d9

View File

@ -122,6 +122,14 @@ KeyEvent::KeyEvent(EventType type, emscripten::val event, QWasmDeadKeySupport *d
key = webKeyToQtKey(code, webKey, deadKey, modifiers);
text = QString::fromUtf8(webKey);
// Alt + keypad number -> insert utf-8 character
// The individual numbers shall not be inserted but
// on some platforms they are if numlock is
// activated
if ((modifiers & Qt::AltModifier) && (modifiers & Qt::KeypadModifier))
text.clear();
if (text.size() > 1)
text.clear();