diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview_keys.mm | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 471fa368c3..8e4efc6fb6 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -125,6 +125,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSViewMouseMoveHelper); Qt::MouseButtons m_frameStrutButtons; QString m_composingText; QPointer<QObject> m_composingFocusObject; + bool m_lastKeyDead; bool m_sendKeyEvent; bool m_dontOverrideCtrlLMB; bool m_sendUpAsRightButton; @@ -142,6 +143,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSViewMouseMoveHelper); { if ((self = [super initWithFrame:NSZeroRect])) { m_platformWindow = platformWindow; + m_lastKeyDead = false; m_sendKeyEvent = false; m_inputSource = nil; m_resendKeyEvent = false; diff --git a/src/plugins/platforms/cocoa/qnsview_keys.mm b/src/plugins/platforms/cocoa/qnsview_keys.mm index 23b8254d63..d58155237e 100644 --- a/src/plugins/platforms/cocoa/qnsview_keys.mm +++ b/src/plugins/platforms/cocoa/qnsview_keys.mm @@ -111,11 +111,15 @@ if (QCoreApplication::sendEvent(fo, &queryEvent)) { bool imEnabled = queryEvent.value(Qt::ImEnabled).toBool(); Qt::InputMethodHints hints = static_cast<Qt::InputMethodHints>(queryEvent.value(Qt::ImHints).toUInt()); - if (imEnabled && !(hints & Qt::ImhDigitsOnly || hints & Qt::ImhFormattedNumbersOnly || hints & Qt::ImhHiddenText)) { + // make sure we send dead keys and the next key to the input method for composition + const bool ignoreHidden = (hints & Qt::ImhHiddenText) && !text.isEmpty() && !m_lastKeyDead; + if (imEnabled && !(hints & Qt::ImhDigitsOnly || hints & Qt::ImhFormattedNumbersOnly || ignoreHidden)) { // pass the key event to the input method. note that m_sendKeyEvent may be set to false during this call m_currentlyInterpretedKeyEvent = nsevent; [self interpretKeyEvents:@[nsevent]]; m_currentlyInterpretedKeyEvent = 0; + // if the last key we sent was dead, then pass the next key to the IM as well to complete composition + m_lastKeyDead = text.isEmpty(); } } } |