diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2016-10-25 08:14:21 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2016-11-08 12:30:45 +0000 |
commit | 356f5bbac3a66701e958896f8075bbacc90439df (patch) | |
tree | 249b9bb78493927831789dbeb343469718c16462 /src/gui | |
parent | 8f2eb9b43c23b03918c50fa721a47f3ab99e4ec6 (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 <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 2ff19f5175..c7ad10a46f 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2462,6 +2462,9 @@ void QWindowPrivate::_q_clearAlert() See the \l{Qt::CursorShape}{list of predefined cursor objects} for a range of useful shapes. + If no cursor has been set, or after a call to unsetCursor(), the + parent window's cursor is used. + By default, the cursor has the Qt::ArrowCursor shape. Some underlying window implementations will reset the cursor if it |