diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2020-02-21 11:11:59 +0100 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2020-02-25 22:15:59 +0100 |
commit | db777c7bde2ad075f2a76cf6d5e9c20b04d62a2d (patch) | |
tree | 23dcb881a3bad09ee58e7b17eb97dc8ededfe5a9 /src | |
parent | 9691111bcb359fe39e97e13820b98385657ae03a (diff) |
Fix event.key for Ctrl key combinations on Windows
Fixes: QTBUG-81783
Change-Id: I107a4009630dc261013498a05987c0e8e29651eb
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/web_event_factory.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index ba04806d5..f4940f305 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -157,8 +157,11 @@ static Qt::KeyboardModifiers qtModifiersForEvent(const QInputEvent *ev) // // On Linux, the Control modifier transformation is applied [1]. For example, // pressing Ctrl+@ generates the text "\u0000". We would like "@" instead. +// Windows also translates some control key combinations into ASCII control +// characters [2]. // // [1]: https://www.x.org/releases/current/doc/kbproto/xkbproto.html#Interpreting_the_Control_Modifier +// [2]: https://docs.microsoft.com/en-us/windows/win32/learnwin32/keyboard-input#character-messages // // On macOS, if the Control modifier is used, then no text is generated at all. // We need some text. @@ -171,8 +174,10 @@ static QString qtTextForKeyEvent(const QKeyEvent *ev, int qtKey, Qt::KeyboardMod { QString text = ev->text(); - if ((qtModifiers & Qt::ControlModifier) && keyboardDriver() == KeyboardDriver::Xkb) + if ((qtModifiers & Qt::ControlModifier) && + (keyboardDriver() == KeyboardDriver::Xkb || keyboardDriver() == KeyboardDriver::Windows)) { text.clear(); + } return text; } |