Deliver context menu event with correct coordinates to widgets in popups
If a popup is open, Qt delivers events to the popup child under the mouse, so we need to correctly translate the local position of the context menu event to that child's coordate system. This is already done correctly for regular mouse events, so use the same logic here. Fixes: QTBUG-99371 Pick-to: 6.2 6.3 5.15 Change-Id: Ief24c755e76d4d1aa2304b06662ed26ae309f684 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
58058794b1
commit
0462d24dcd
@ -617,7 +617,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
|
||||
receiver = qt_button_down;
|
||||
else if (popupChild)
|
||||
receiver = popupChild;
|
||||
QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPosition().toPoint(), event->modifiers());
|
||||
const QPoint localPos = receiver->mapFromGlobal(event->globalPosition().toPoint());
|
||||
QContextMenuEvent e(QContextMenuEvent::Mouse, localPos, event->globalPosition().toPoint(), event->modifiers());
|
||||
QApplication::forwardEvent(receiver, &e, event);
|
||||
}
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user