Fix menu first radio button state and synchronise state changes.
This commit is contained in:
@@ -53,7 +53,7 @@ static wxMenuItem *GetMenuItemAt( const wxMenu *menu, size_t position )
|
||||
|
||||
|
||||
static void InsertMenuItemAction( const wxMenu *menu, const wxMenuItem *previousItem,
|
||||
const wxMenuItem *item, const wxMenuItem *successiveItem )
|
||||
wxMenuItem *item, const wxMenuItem *successiveItem )
|
||||
{
|
||||
QMenu *qtMenu = menu->GetHandle();
|
||||
QAction *itemAction = item->GetHandle();
|
||||
@@ -74,6 +74,7 @@ static void InsertMenuItemAction( const wxMenu *menu, const wxMenuItem *previous
|
||||
{
|
||||
QActionGroup *actionGroup = new QActionGroup( qtMenu );
|
||||
actionGroup->addAction( itemAction );
|
||||
item->Check();
|
||||
wxASSERT_MSG( itemAction->actionGroup() == actionGroup, "Must be the same action group" );
|
||||
}
|
||||
break;
|
||||
|
@@ -165,5 +165,6 @@ void wxQtAction::onActionTriggered( bool checked )
|
||||
{
|
||||
wxMenuItem *handler = GetHandler();
|
||||
wxMenu *menu = handler->GetMenu();
|
||||
if(handler->IsCheckable()) handler->Check(checked);
|
||||
menu->SendEvent( handler->GetId(), handler->IsCheckable() ? checked : -1 );
|
||||
}
|
||||
|
Reference in New Issue
Block a user