diff options
Diffstat (limited to 'src/gui/kernel/qwidget_mac.mm')
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index f389bfd..f5a8c5f 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -1304,11 +1304,8 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event, if(part == kControlFocusNoPart){ if (widget->hasFocus()) QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason); - } else if (widget->focusPolicy() != Qt::NoFocus) { + } else widget->setFocus(); - } else { - handled_event = false; - } } if(!HIObjectIsOfClass((HIObjectRef)hiview, kObjectQWidget)) CallNextEventHandler(er, event); @@ -3593,11 +3590,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()) { @@ -3635,6 +3636,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; @@ -3654,6 +3656,7 @@ void QWidgetPrivate::lower_sys() for (NSView *subview in subviews) [parentView addSubview:subview]; [subviews release]; + [[myview window] makeFirstResponder:firstResponder]; } #else if(q->isWindow()) { |