Fix position for wxContextMenuEvent generated from keyboard

The position was wrong for the keyboard-triggered menu events in
wxWindows containing multiple sub-windows, such as wxListCtrl.

Closes https://github.com/wxWidgets/wxWidgets/pull/1352
This commit is contained in:
Matthew Griffin 2019-06-12 15:48:14 +01:00 committed by Vadim Zeitlin
parent 71ad73fdbe
commit 0c7f261c4a

View File

@ -1568,7 +1568,11 @@ bool wxWindowQt::QtHandleCloseEvent ( QWidget *handler, QCloseEvent *WXUNUSED( e
bool wxWindowQt::QtHandleContextMenuEvent ( QWidget *WXUNUSED( handler ), QContextMenuEvent *event )
{
wxContextMenuEvent e( wxEVT_CONTEXT_MENU, GetId() );
e.SetPosition( wxQtConvertPoint( event->globalPos() ) );
e.SetPosition(
event->reason() == QContextMenuEvent::Keyboard
? wxDefaultPosition
: wxQtConvertPoint( event->globalPos() )
);
e.SetEventObject(this);
return ProcessWindowEvent( e );