diff options
author | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-03-22 18:02:26 +0100 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-03-30 10:44:08 +0000 |
commit | 3439705c2d4e5a1a2817e91d1ce4553dde81d2fe (patch) | |
tree | b184c1bcc6395f6256a99da37d60355389748c12 /src/plugins | |
parent | 91f8c9cc70bbfb752811cd29945fb37ff863d524 (diff) |
Cocoa integration - hitTest for Qt::WindowTransparentForInput
In case Qt::WindowTransparentForInput is set on a window, we
usually call [super someRelatedMethod] on a corresponding QNSView, for example,
[super mouseDown:theEvent]. Unfortunately, Cocoa will continue
to report the subsequent mouse dragging events to the first view where
mouse down occurred, despite of us passing mouse down to the next reponder.
Dragging events we'll also 'propagate' by calling super's method,
but it's not working properly, since the current view below
probably did not have that first mouse down event thus it does not have m_buttons set
correctly. And even worse with the closing mouseUp event. So, let's use
-hitTest: returning nil on such a 'transparent' view so that it's ignored by mouse events.
Task-number: QTBUG-40583
Change-Id: I5e0fef3e246a29332df758a692300d478b862069
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 9905c85d77..cbb4888718 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -684,6 +684,16 @@ QT_WARNING_POP return YES; } +- (NSView *)hitTest:(NSPoint)aPoint +{ + NSView *candidate = [super hitTest:aPoint]; + if (candidate == self) { + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput)) + return nil; + } + return candidate; +} + - (void)convertFromScreen:(NSPoint)mouseLocation toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint { // Calculate the mouse position in the QWindow and Qt screen coordinate system, |