mirror of https://github.com/qt/qtbase.git
macOS: Check NSEvent.characters to determine dead key state
We map NSEvent.characters to text that we pass on in our QKeyEvent,
but for Qt 4 compatibility we explicitly skip function keys and arrow
keys, as the text these events produce are control characters. See
4dbce2a469
.
However, these keys are not dead keys, so we can't use the resolved
text we're planning to pass on to Qt to determine if they are.
Pick-to: 6.2
Change-Id: Ib59f0489ae014379c699600f14634c55161ccc8a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
294e4c7aa8
commit
abdd524519
|
@ -118,7 +118,8 @@
|
|||
auto hints = static_cast<Qt::InputMethodHints>(queryResult.value(Qt::ImHints).toUInt());
|
||||
|
||||
// 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;
|
||||
const bool isDeadKey = !nsevent.characters.length;
|
||||
const bool ignoreHidden = (hints & Qt::ImhHiddenText) && !isDeadKey && !m_lastKeyDead;
|
||||
|
||||
if (!(hints & Qt::ImhDigitsOnly || hints & Qt::ImhFormattedNumbersOnly || ignoreHidden)) {
|
||||
// Pass the key event to the input method. Note that m_sendKeyEvent may be set
|
||||
|
@ -139,7 +140,7 @@
|
|||
|
||||
// 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();
|
||||
m_lastKeyDead = isDeadKey;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue