diff options
author | Lorn Potter <lorn.potter@gmail.com> | 2020-06-01 17:46:30 +1000 |
---|---|---|
committer | Lorn Potter <lorn.potter@gmail.com> | 2020-06-29 09:39:19 +1000 |
commit | 0707b85cda9e621df26b49cddf08f82b28a3f907 (patch) | |
tree | 178dd0090379776d1444053adbb4dba03e4f3146 /src/plugins | |
parent | 76c3eee4020cae681857ee17406c655f61f9082c (diff) |
wasm: search emscripten key first
This fixes key lookups with different keyboard layouts
Pick-to: 5.15
Fixes: QTBUG-84494
Change-Id: I18f1643331961d9bfc1ac6977181f8959e76449d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/wasm/qwasmeventtranslator.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp index 77decc970d..8eb30c0ecd 100644 --- a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp +++ b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp @@ -433,20 +433,21 @@ Qt::Key QWasmEventTranslator::translateEmscriptKey(const EmscriptenKeyboardEvent { Qt::Key qtKey = Qt::Key_unknown; - if (qstrncmp(emscriptKey->code, "Key", 3) == 0 || qstrncmp(emscriptKey->code, "Numpad", 6) == 0 || - qstrncmp(emscriptKey->code, "Digit", 5) == 0) { + if (qstrncmp(emscriptKey->key, "Dead", 4) == 0 ) { + emkb2qt_t searchKey1{emscriptKey->code, 0}; + for (auto it1 = KeyTbl.cbegin(); it1 != KeyTbl.end(); ++it1) + if (it1 != KeyTbl.end() && (qstrcmp(searchKey1.em, it1->em) == 0)) { + qtKey = static_cast<Qt::Key>(it1->qt); + } + + } else if (qstrncmp(emscriptKey->code, "Key", 3) == 0 || qstrncmp(emscriptKey->code, "Numpad", 6) == 0 || + qstrncmp(emscriptKey->code, "Digit", 5) == 0) { emkb2qt_t searchKey{emscriptKey->code, 0}; // search emcsripten code auto it1 = std::lower_bound(KeyTbl.cbegin(), KeyTbl.cend(), searchKey); if (it1 != KeyTbl.end() && !(searchKey < *it1)) { qtKey = static_cast<Qt::Key>(it1->qt); } - } else if (qstrncmp(emscriptKey->key, "Dead", 4) == 0 ) { - emkb2qt_t searchKey1{emscriptKey->code, 0}; - for (auto it1 = KeyTbl.cbegin(); it1 != KeyTbl.end(); ++it1) - if (it1 != KeyTbl.end() && (qstrcmp(searchKey1.em, it1->em) == 0)) { - qtKey = static_cast<Qt::Key>(it1->qt); - } } if (qtKey == Qt::Key_unknown) { |