diff options
author | Gatis Paeglis <gatis.paeglis@digia.com> | 2013-05-28 13:09:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-10 23:29:28 +0200 |
commit | b2a0a1437000c6cd78de4bf960993732457a8e92 (patch) | |
tree | 28dbd2b7988d0a47a0380c5118a9556eb5e3ac8e /src | |
parent | 074c5c94f6018d08abac9bad5151f9300284feb4 (diff) |
Fix issue when QKeyEvent::text() was returning empty string
The code that sets 'text' variable was executed only for KeyPress
events. This patch moves 'text' initialization higher up where it
will be run for both - KeyPress and KeyRelease events.
Task-number: QTBUG-31285
Change-Id: I140de9ef5d29beedad276d348bed964ecdf46f9d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 5c5da830ac..10fb293ec0 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -917,13 +917,13 @@ static QTouchDevice *touchDevice = 0; // we will send a key event unless the input method sets m_sendKeyEvent to false m_sendKeyEvent = true; - QString text; + // 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 (ch.unicode() < 0xf700 || ch.unicode() > 0xf8ff) + text = QCFString::toQString(characters); + if (eventType == QEvent::KeyPress) { - // 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 (ch.unicode() < 0xf700 || ch.unicode() > 0xf8ff) - text = QCFString::toQString(characters); if (m_composingText.isEmpty()) m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutEvent(m_window, timestamp, keyCode, modifiers, text); |