diff options
author | Jüri Valdmann <juri.valdmann@qt.io> | 2018-10-31 15:30:08 +0100 |
---|---|---|
committer | Jüri Valdmann <juri.valdmann@qt.io> | 2018-10-31 16:16:10 +0000 |
commit | 1f90c16845dfda2639712354ded1121b5c999ef3 (patch) | |
tree | 7c7f01e8a4558a244a8c1830924174169a276cfc /src/core/web_event_factory.cpp | |
parent | b39a5083751605e2ba781393b6b8ea69381efdf4 (diff) |
Don't use Qt::Key fallback for WebKeyboardEvent.text
Fixes: QTBUG-71454
Change-Id: I80a530bea69da2e8bfe0b99206f590c0ea389796
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/core/web_event_factory.cpp')
-rw-r--r-- | src/core/web_event_factory.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 04d4930ec..680e1a44c 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -174,14 +174,6 @@ static QString qtTextForKeyEvent(const QKeyEvent *ev, int qtKey, Qt::KeyboardMod if ((qtModifiers & Qt::ControlModifier) && keyboardDriver() == KeyboardDriver::Xkb) text.clear(); - if (!text.isEmpty() || qtKey >= Qt::Key_Escape) - return text; - - QChar ch(qtKey); - if (!(qtModifiers & Qt::ShiftModifier)) // No way to check for caps lock - ch = ch.toLower(); - - text.append(ch); return text; } @@ -1493,6 +1485,12 @@ content::NativeWebKeyboardEvent WebEventFactory::toWebKeyboardEvent(QKeyEvent *e webKitEvent.dom_key = domKeyForQtKey(qtKey); else if (!qtText.isEmpty()) webKitEvent.dom_key = ui::DomKey::FromCharacter(qtText.toUcs4().first()); + else { + QChar ch(qtKey); + if (!(qtModifiers & Qt::ShiftModifier)) // No way to check for caps lock + ch = ch.toLower(); + webKitEvent.dom_key = ui::DomKey::FromCharacter(ch.unicode()); + } // The dom_code field should contain the USB keycode of the *physical* key // that was pressed. Physical meaning independent of layout and modifiers. |