Fix wxContextMenuEvent event propagation under wxQt

Closes #23973.
This commit is contained in:
ali kettab 2023-10-17 02:49:04 +01:00 committed by Vadim Zeitlin
parent 5d30f84125
commit 6d7f9342be

View file

@ -148,10 +148,20 @@ protected:
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleContextMenuEvent(this, event) )
Widget::contextMenuEvent(event);
else
event->accept();
this->GetHandler()->QtHandleContextMenuEvent(this, event);
// Notice that we are simply accepting the event and deliberately not
// calling Widget::contextMenuEvent(event); here because the context menu
// is supposed to be shown from a wxEVT_CONTEXT_MENU handler and not from
// QWidget::contextMenuEvent() overrides (and we are already in one of
// these overrides to perform QContextMenuEvent --> wxContextMenuEvent
// translation).
// More importantly, the default implementation of contextMenuEvent() simply
// ignores the context event, which means that the event will be propagated
// to the parent widget again which is undesirable here because the event may
// have already been propagated at the wxWidgets level.
event->accept();
}
//wxDropFilesEvent