summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qcocoaview_mac.mm
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2009-04-08 11:43:39 (GMT)
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2009-04-08 11:43:39 (GMT)
commit8da880e77db04cc4509e0f48e0b5b1d6265da223 (patch)
treeb6dbd9ceb780e7524cc55a3a63dbf7ef17452036 /src/gui/kernel/qcocoaview_mac.mm
parent7edc2b05cfdf143c7f8ac444f93db918a5fd5344 (diff)
downloadQt-8da880e77db04cc4509e0f48e0b5b1d6265da223.zip
Qt-8da880e77db04cc4509e0f48e0b5b1d6265da223.tar.gz
Qt-8da880e77db04cc4509e0f48e0b5b1d6265da223.tar.bz2
QTextEdit character are lost after special characters like ^ ยด `
This happens only on keyboard layouts like French. The is mainly due to the key event processing done by the Input manager. In carbon, the key down event has to be replayed after the input manager finishes his processing. In Cocoa, while unmarking we have to accept the current text. Task-number: 123740 Reviewed-by: nrc
Diffstat (limited to 'src/gui/kernel/qcocoaview_mac.mm')
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 19367d1..2d6f5ad 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -195,6 +195,7 @@ extern "C" {
if (self) {
[self finishInitWithQWidget:widget widgetPrivate:widgetprivate];
}
+ composingText = new QString();
composing = false;
sendKeyEvents = true;
[self setHidden:YES];
@@ -364,6 +365,7 @@ extern "C" {
- (void)dealloc
{
+ delete composingText;
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
@@ -917,7 +919,7 @@ extern "C" {
- (void) insertText:(id)aString
{
- if (composing) {
+ if ([aString length]) {
// Send the commit string to the widget.
QString commitText;
if ([aString isKindOfClass:[NSAttributedString class]]) {
@@ -931,6 +933,7 @@ extern "C" {
e.setCommitString(commitText);
qt_sendSpontaneousEvent(qwidget, &e);
}
+ composingText->clear();
}
- (void) setMarkedText:(id)aString selectedRange:(NSRange)selRange
@@ -984,12 +987,21 @@ extern "C" {
attrs<<QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat,
0, composingLength, format);
}
+ *composingText = qtText;
QInputMethodEvent e(qtText, attrs);
qt_sendSpontaneousEvent(qwidget, &e);
+ if (!composingLength)
+ composing = false;
}
- (void) unmarkText
{
+ if (composing) {
+ QInputMethodEvent e;
+ e.setCommitString(*composingText);
+ qt_sendSpontaneousEvent(qwidget, &e);
+ }
+ composingText->clear();
composing = false;
}