summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowskeymapper.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-05 08:58:48 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-05 08:58:48 +0200
commit69ef0481fc22ec3f0d7fa220a47a27fecf76a710 (patch)
treef6d96cc257fcb27e12151f079c583251df4c4720 /src/plugins/platforms/windows/qwindowskeymapper.cpp
parentdbfd7f304c4d91096e104ec2383d92a37502d836 (diff)
parent91a2c8630b2204831566ab8e523c747f9d8ec927 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: I6f3878b204464313aa2f9d988d3b35121d4d9867
Diffstat (limited to 'src/plugins/platforms/windows/qwindowskeymapper.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 5b2370b69d..ae3c477399 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -43,6 +43,7 @@
#include "qwindowswindow.h"
#include "qwindowsinputcontext.h"
+#include <QtGui/QGuiApplication>
#include <QtGui/QWindow>
#include <qpa/qwindowsysteminterface.h>
#include <private/qguiapplication_p.h>
@@ -1078,6 +1079,21 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
if (PeekMessage(&wm_char, 0, charType, charType, PM_REMOVE)) {
// Found a ?_CHAR
uch = QChar(ushort(wm_char.wParam));
+ if (uch.isHighSurrogate()) {
+ m_lastHighSurrogate = uch;
+ return true;
+ } else if (uch.isLowSurrogate() && !m_lastHighSurrogate.isNull()) {
+ if (QObject *focusObject = QGuiApplication::focusObject()) {
+ const QChar chars[2] = {m_lastHighSurrogate, uch};
+ QInputMethodEvent event;
+ event.setCommitString(QString(chars, 2));
+ QCoreApplication::sendEvent(focusObject, &event);
+ }
+ m_lastHighSurrogate = QChar();
+ return true;
+ } else {
+ m_lastHighSurrogate = QChar();
+ }
if (msgType == WM_SYSKEYDOWN && uch.isLetter() && (msg.lParam & KF_ALTDOWN))
uch = uch.toLower(); // (See doc of WM_SYSCHAR) Alt-letter
if (!code && !uch.row())