diff options
author | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2010-08-13 14:42:16 (GMT) |
---|---|---|
committer | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2010-08-13 14:45:51 (GMT) |
commit | 3411ac72ffcbd8152342603152193aa7283bd149 (patch) | |
tree | a383550020b6cea478d32aec1da9b535330a8741 /src | |
parent | 6c2662c9d4d0813622ee5a9783911dbe2e48e72c (diff) | |
download | Qt-3411ac72ffcbd8152342603152193aa7283bd149.zip Qt-3411ac72ffcbd8152342603152193aa7283bd149.tar.gz Qt-3411ac72ffcbd8152342603152193aa7283bd149.tar.bz2 |
Cannot enter text through character viewer on Mac (Cocoa)
This text is delivered through the NSTextInput protocol. Since it was not
initiated from a keyDown message, we were ignoring the insertText: message.
Reviewed-by: Denis
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qcocoaview_mac.mm | 8 | ||||
-rw-r--r-- | src/gui/kernel/qcocoaview_mac_p.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 3229e71..0282c79 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -207,6 +207,7 @@ static int qCocoaViewCount = 0; composing = false; sendKeyEvents = true; + fromKeyDownEvent = false; [self setHidden:YES]; return self; } @@ -1215,7 +1216,9 @@ static int qCocoaViewCount = 0; && !(widgetToGetKey->inputMethodHints() & Qt::ImhDigitsOnly || widgetToGetKey->inputMethodHints() & Qt::ImhFormattedNumbersOnly || widgetToGetKey->inputMethodHints() & Qt::ImhHiddenText)) { + fromKeyDownEvent = true; [qt_mac_nativeview_for(widgetToGetKey) interpretKeyEvents:[NSArray arrayWithObject: theEvent]]; + fromKeyDownEvent = false; } if (sendKeyEvents && !composing) { bool keyOK = qt_dispatchKeyEvent(theEvent, widgetToGetKey); @@ -1285,7 +1288,10 @@ static int qCocoaViewCount = 0; }; } - if ([aString length] && composing) { + // When entering characters through Character Viewer or Keyboard Viewer, the text is passed + // through this insertText method. Since we dont receive a keyDown Event in such cases, the + // composing flag will be false. + if (([aString length] && composing) || !fromKeyDownEvent) { // Send the commit string to the widget. composing = false; sendKeyEvents = false; diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h index b6b63ca..511423357 100644 --- a/src/gui/kernel/qcocoaview_mac_p.h +++ b/src/gui/kernel/qcocoaview_mac_p.h @@ -86,6 +86,7 @@ Q_GUI_EXPORT bool composing; int composingLength; bool sendKeyEvents; + bool fromKeyDownEvent; QString *composingText; NSInteger dragEnterSequence; } |