diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2019-02-08 15:01:28 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2019-02-11 01:41:44 +0000 |
commit | 4697467e9888d7631841af6be436ed58e41f4759 (patch) | |
tree | 61fa848d257fb616bda9118a56731b6c2aa5bc13 | |
parent | 6f9e444c28c0095595b1b61cb0f399ac2790716b (diff) |
macOS: Explain QNSViewMouseMoveHelper for future generations
Change-Id: I61f38ee38d5afb657cd8b76b2b9dba1dac7167b4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview_mouse.mm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview_mouse.mm b/src/plugins/platforms/cocoa/qnsview_mouse.mm index 3d6471005d..563a66515a 100644 --- a/src/plugins/platforms/cocoa/qnsview_mouse.mm +++ b/src/plugins/platforms/cocoa/qnsview_mouse.mm @@ -39,6 +39,22 @@ // This file is included from qnsview.mm, and only used to organize the code +/* + The reason for using this helper is to ensure that QNSView doesn't implement + the NSResponder callbacks for mouseEntered, mouseExited, and mouseMoved. + + If it did, we would get mouse events though the responder chain as well, + for example if a subview has a tracking area of its own and calls super + in the handler, which results in forwarding the event though the responder + chain. The same applies if NSWindow.acceptsMouseMovedEvents is YES. + + By having a helper as the target for our tracking areas, we know for sure + that the events we are getting stem from our own tracking areas. + + FIXME: Ideally we wouldn't need this workaround, and would correctly + interact with the responder chain by e.g. calling super if Qt does not + accept the mouse event +*/ @implementation QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) { QNSView *view; } |