diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-07-13 10:29:36 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-07-16 12:37:18 +0200 |
commit | c563e5b3c7f483684da0759a28393b2140541771 (patch) | |
tree | 5dd196e7c5b5f98a17b341fe72d5d0bd745f5e8f /src/plugins/platforms/wasm/qwasmeventtranslator.h | |
parent | aeaf5d87ed0a41dd9f8265f9d88b34e233a89f74 (diff) |
QWasmEventTranslator: replace five QHash with constexpr C arrays
The mapping is static, but a dynamic (even mutable) container was
used.
Fix by using C tables and liner scan, which will be just as fast or
faster than a hash lookup, for the maximum of six entries of each
table.
Change-Id: I899d5b1428dc82cf58862f238595a266aef8279f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmeventtranslator.h')
-rw-r--r-- | src/plugins/platforms/wasm/qwasmeventtranslator.h | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.h b/src/plugins/platforms/wasm/qwasmeventtranslator.h index 1655b7226a..568ae00732 100644 --- a/src/plugins/platforms/wasm/qwasmeventtranslator.h +++ b/src/plugins/platforms/wasm/qwasmeventtranslator.h @@ -77,42 +77,6 @@ private: Qt::Key translateDeadKey(Qt::Key deadKey, Qt::Key accentBaseKey); - QHash<Qt::Key , Qt::Key> tildeKeyTable { // ~ - { Qt::Key_A, Qt::Key_Atilde}, - { Qt::Key_N, Qt::Key_Ntilde}, - { Qt::Key_O, Qt::Key_Otilde} - }; - QHash<Qt::Key , Qt::Key> graveKeyTable { // ` - { Qt::Key_A, Qt::Key_Agrave}, - { Qt::Key_E, Qt::Key_Egrave}, - { Qt::Key_I, Qt::Key_Igrave}, - { Qt::Key_O, Qt::Key_Ograve}, - { Qt::Key_U, Qt::Key_Ugrave} - }; - QHash<Qt::Key , Qt::Key> acuteKeyTable { // ' - { Qt::Key_A, Qt::Key_Aacute}, - { Qt::Key_E, Qt::Key_Eacute}, - { Qt::Key_I, Qt::Key_Iacute}, - { Qt::Key_O, Qt::Key_Oacute}, - { Qt::Key_U, Qt::Key_Uacute}, - { Qt::Key_Y, Qt::Key_Yacute} - }; - QHash<Qt::Key , Qt::Key> diaeresisKeyTable { // umlaut ยจ - { Qt::Key_A, Qt::Key_Adiaeresis}, - { Qt::Key_E, Qt::Key_Ediaeresis}, - { Qt::Key_I, Qt::Key_Idiaeresis}, - { Qt::Key_O, Qt::Key_Odiaeresis}, - { Qt::Key_U, Qt::Key_Udiaeresis}, - { Qt::Key_Y, Qt::Key_ydiaeresis} - }; - QHash<Qt::Key , Qt::Key> circumflexKeyTable { // ^ - { Qt::Key_A, Qt::Key_Acircumflex}, - { Qt::Key_E, Qt::Key_Ecircumflex}, - { Qt::Key_I, Qt::Key_Icircumflex}, - { Qt::Key_O, Qt::Key_Ocircumflex}, - { Qt::Key_U, Qt::Key_Ucircumflex} - }; - QMap <int, QPointF> pressedTouchIds; private: |