QWidgetWindow: Restrict context menu trigger to the widget's rectangle.

Task-number: QTBUG-44913
Change-Id: I0d9411b4bbd6a6affe85eb9856a1eb93d444d377
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
This commit is contained in:
Friedemann Kleint 2015-03-11 13:43:13 +01:00
parent 5f324097f2
commit 56c8a19044

View File

@ -554,7 +554,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
&qt_button_down, qt_last_mouse_receiver);
}
#ifndef QT_NO_CONTEXTMENU
if (event->type() == contextMenuTrigger && event->button() == Qt::RightButton) {
if (event->type() == contextMenuTrigger && event->button() == Qt::RightButton
&& m_widget->rect().contains(event->pos())) {
QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers());
QGuiApplication::sendSpontaneousEvent(receiver, &e);
}