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>bb10
parent
91f8c9cc70
commit
3439705c2d
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue