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:
committed by
Vadim Zeitlin
parent
71ad73fdbe
commit
0c7f261c4a
@@ -1568,7 +1568,11 @@ bool wxWindowQt::QtHandleCloseEvent ( QWidget *handler, QCloseEvent *WXUNUSED( e
|
|||||||
bool wxWindowQt::QtHandleContextMenuEvent ( QWidget *WXUNUSED( handler ), QContextMenuEvent *event )
|
bool wxWindowQt::QtHandleContextMenuEvent ( QWidget *WXUNUSED( handler ), QContextMenuEvent *event )
|
||||||
{
|
{
|
||||||
wxContextMenuEvent e( wxEVT_CONTEXT_MENU, GetId() );
|
wxContextMenuEvent e( wxEVT_CONTEXT_MENU, GetId() );
|
||||||
e.SetPosition( wxQtConvertPoint( event->globalPos() ) );
|
e.SetPosition(
|
||||||
|
event->reason() == QContextMenuEvent::Keyboard
|
||||||
|
? wxDefaultPosition
|
||||||
|
: wxQtConvertPoint( event->globalPos() )
|
||||||
|
);
|
||||||
e.SetEventObject(this);
|
e.SetEventObject(this);
|
||||||
|
|
||||||
return ProcessWindowEvent( e );
|
return ProcessWindowEvent( e );
|
||||||
|
Reference in New Issue
Block a user