summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-06-05 11:30:03 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-06-05 11:39:38 (GMT)
commit5740b034811794e0c33496cf0eeb81ba471cc018 (patch)
treef368abf9bc2590fe2cd7c38d24d1dee99940ffb6 /src
parent35bdd8942716c716113e5b795186ca76199e8d96 (diff)
downloadQt-5740b034811794e0c33496cf0eeb81ba471cc018.zip
Qt-5740b034811794e0c33496cf0eeb81ba471cc018.tar.gz
Qt-5740b034811794e0c33496cf0eeb81ba471cc018.tar.bz2
Example MDI: keybord focus not working correctly!
The reason is that cocoa looses the first responder when we raise the fake window inside the MDA area. So we need to re-set the first responder again Task-number: 255040 Reviewed-by: Trenton Schulz
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qwidget_mac.mm8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index c82b87d..68eaf6f 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3603,11 +3603,15 @@ void QWidgetPrivate::raise_sys()
}
} else {
// Cocoa doesn't really have an idea of Z-ordering, but you can
- // fake it by changing the order of it.
+ // fake it by changing the order of it. But beware, removing an
+ // NSView will also remove it as the first responder. So we re-set
+ // the first responder just in case:
NSView *view = qt_mac_nativeview_for(q);
NSView *parentView = [view superview];
+ NSResponder *firstResponder = [[view window] firstResponder];
[view removeFromSuperview];
[parentView addSubview:view];
+ [[view window] makeFirstResponder:firstResponder];
}
#else
if(q->isWindow()) {
@@ -3645,6 +3649,7 @@ void QWidgetPrivate::lower_sys()
NSArray *tmpViews = [parentView subviews];
NSMutableArray *subviews = [[NSMutableArray alloc] initWithCapacity:[tmpViews count]];
[subviews addObjectsFromArray:tmpViews];
+ NSResponder *firstResponder = [[myview window] firstResponder];
// Implicit assumption that myViewIndex is included in subviews, that's why I'm not checking
// myViewIndex.
NSUInteger index = 0;
@@ -3664,6 +3669,7 @@ void QWidgetPrivate::lower_sys()
for (NSView *subview in subviews)
[parentView addSubview:subview];
[subviews release];
+ [[myview window] makeFirstResponder:firstResponder];
}
#else
if(q->isWindow()) {