From 321a5495101b769feb6dae1dcb703effc9e3bd52 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Tue, 22 May 2012 13:38:19 +0200 Subject: Cocoa: Avoid UTF-16 to UTF-8 to UTF-16 conversion in key handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/platforms/cocoa/qnsview.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 755b393af2..09ba1c50ae 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -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); -- cgit v1.2.3