diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 8 |
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()) { |