summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qnsview.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview.mm')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 678f88baa0..d653bd9cee 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -330,8 +330,25 @@ static QTouchDevice *touchDevice = 0;
return YES;
}
+- (BOOL)becomeFirstResponder
+{
+ QWindow *focusWindow = m_window;
+
+ // For widgets we need to do a bit of trickery as the window
+ // to activate is the window of the top-level widget.
+ if (m_window->metaObject()->className() == QStringLiteral("QWidgetWindow")) {
+ while (focusWindow->parent()) {
+ focusWindow = focusWindow->parent();
+ }
+ }
+ QWindowSystemInterface::handleWindowActivated(focusWindow);
+ return YES;
+}
+
- (BOOL)acceptsFirstResponder
{
+ if ((m_window->flags() & Qt::ToolTip) == Qt::ToolTip)
+ return NO;
return YES;
}