Fix enter/leave event generation between native widgets when grabbing.

Removed enter/leave event generation when moving between between
related windows in QWidgetWindow (i.e. native widgets) while some
widget was explicitly grabbing the mouse input. This makes enter/leave
event generation identical to non-native widgets.

Task-number: QTBUG-27551
Change-Id: I4996007bd7922e073a2957ad267a6373e8f3fecc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Miikka Heikkinen 2012-10-26 11:30:22 +03:00 committed by The Qt Project
parent 0f14ea3f3a
commit 8ac2ea94d3

View File

@ -239,9 +239,14 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
}
}
}
QWidget *leave = qt_last_mouse_receiver ? qt_last_mouse_receiver.data() : m_widget;
QApplicationPrivate::dispatchEnterLeave(enter, leave);
qt_last_mouse_receiver = enter;
// Enter-leave between sibling widgets is ignored when there is a mousegrabber - this makes
// both native and non-native widgets work similarly.
// When mousegrabbing, leaves are only generated if leaving the parent window.
if (!enter || !QWidget::mouseGrabber()) {
QWidget *leave = qt_last_mouse_receiver ? qt_last_mouse_receiver.data() : m_widget;
QApplicationPrivate::dispatchEnterLeave(enter, leave);
qt_last_mouse_receiver = enter;
}
} else {
QApplicationPrivate::dispatchEnterLeave(m_widget, 0);
qt_last_mouse_receiver = m_widget;