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>
This commit is contained in:
Gatis Paeglis 2013-05-28 13:09:20 +02:00 committed by The Qt Project
parent 074c5c94f6
commit b2a0a14370

View File

@ -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);