path: root/src/plugins/platforms/cocoa/qcocoawindow.h
diff options
authorMorten Johan Sørvig <>2016-10-25 08:14:21 +0200
committerMorten Johan Sørvig <>2016-11-08 12:30:45 +0000
commit356f5bbac3a66701e958896f8075bbacc90439df (patch)
tree249b9bb78493927831789dbeb343469718c16462 /src/plugins/platforms/cocoa/qcocoawindow.h
parent8f2eb9b43c23b03918c50fa721a47f3ab99e4ec6 (diff)
Cocoa: Make child window cursors work correctly
The existing cursor logic had a couple of issues: - It made the faulty assumption that we could not use the NSWindow invalidateCursorRectsForView API for child NSViews. - It used NSWindow invalidateCursorRectsForView and NSView resetCursorRects. This API has been replaced by the more general NSTrackingArea API. - It did not implement falling back to the parent window cursor if the current window has no cursor set. Document that QWindow cursors work the same way as QWidget cursors in that a QWindow with no set cursor will fall back to the parent window cursor. Change the cocoa platform code to use NSTrackingArea exclusively and implement NSView cursorUpdate which sets the cursor. Handle immediate change on QWindow:: setCursor() manually. Add QWindow::effectiveWindowCursor() and applyEffectiveWindowCursor() which finds the correct window cursor. Add a manual test for the child window, child widget, and QWidget::createWindowChild cases. Task-number: QTBUG-33479 Task-number: QTBUG-52023 Change-Id: I0370e11bbadb2da95e8632e61be6228ec2cd5e9d Reviewed-by: Timur Pocheptsov <>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.h')
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 9cf6328281..bf28f83540 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -236,6 +236,8 @@ public:
void setMenubar(QCocoaMenuBar *mb);
QCocoaMenuBar *menubar() const;
+ NSCursor *effectiveWindowCursor() const;
+ void applyEffectiveWindowCursor();
void setWindowCursor(NSCursor *cursor);
void registerTouch(bool enable);