Propagate the event acceptance correctly with context menu on RMB

The context menu event created in QWidgetWindow::handleMouseEvent
does not forward its acceptance flag on which a client may rely.

Task-number: QTBUG-106389
Backport-to: 6.4 6.4.0
Change-Id: I17a53ebd23b4ae0a2721c629f3ecc7aeec56233d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
bb10
Mikolaj Boc 2022-09-07 17:20:35 +02:00
parent 5d38e1f295
commit 5d4178ff47
1 changed files with 2 additions and 0 deletions

View File

@ -629,6 +629,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
&& m_widget->rect().contains(event->position().toPoint())) {
QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPosition().toPoint(), event->modifiers());
QGuiApplication::forwardEvent(receiver, &e, event);
if (e.isAccepted())
event->accept();
}
#endif
}