Cocoa: Avoid UTF-16 to UTF-8 to UTF-16 conversion in key handling
When coverting NSEvent characters to a QString, use QCFString::toQString(), which copies the UTF-16 characters out of the NSString into a QString (instead of converting to UTF-8 and back again on each key press). Change-Id: I78f7c46e75283b7b51c762fd7f22e351ac068072 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
This commit is contained in:
parent
2d05d3bd28
commit
321a549510
@ -623,7 +623,7 @@ static QTouchDevice *touchDevice = 0;
|
||||
// ignore text for the U+F700-U+F8FF range. This is used by Cocoa when
|
||||
// delivering function keys (e.g. arrow keys, backspace, F1-F35, etc.)
|
||||
if ([charactersIgnoringModifiers length] == 1 && (ch.unicode() < 0xf700 || ch.unicode() > 0xf8ff))
|
||||
text = QString::fromUtf8([[nsevent characters] UTF8String]);
|
||||
text = QCFString::toQString([nsevent characters]);
|
||||
|
||||
if (m_composingText.isEmpty())
|
||||
m_sendKeyEvent = !QWindowSystemInterface::tryHandleSynchronousShortcutEvent(m_window, timestamp, keyCode, modifiers, text);
|
||||
|
Loading…
Reference in New Issue
Block a user