diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-05-29 09:53:43 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-06-01 10:06:33 +0200 |
commit | 3698ff07b98eac0516cdecbebed456199d18d65f (patch) | |
tree | 0707562d3a118c1a1a6361ce234ba5b24162523e | |
parent | 42b390cb0131d867e89888d879e34025658e99c2 (diff) |
Add radiobuttons to native menus
Change-Id: I015bbb0a337b917096ca6f542a73c24c79fbef7d
-rw-r--r-- | vcl/qt5/Qt5Menu.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx index 6c219aff7557..e61595af4850 100644 --- a/vcl/qt5/Qt5Menu.cxx +++ b/vcl/qt5/Qt5Menu.cxx @@ -87,6 +87,7 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu ) if ( mbMenuBar && mpQMenuBar ) mpQMenuBar->clear(); + QActionGroup* pQAG = nullptr; for ( sal_Int32 nItem = 0; nItem < static_cast<sal_Int32>(GetItemCount()); nItem++ ) { @@ -105,8 +106,11 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu ) else { if( pSalMenuItem->mpSubMenu ) + { // submenu pQMenu = pQMenu->addMenu( toQString(aText) ); + pQAG = new QActionGroup( pQMenu ); + } else { if ( pSalMenuItem->mnType == MenuItemType::SEPARATOR ) @@ -122,6 +126,16 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu ) pAction->setCheckable( true ); pAction->setChecked( bChecked ); } + else if (itemBits & MenuItemBits::RADIOCHECK) + { + pAction->setCheckable(true); + if ( !pQAG ) + { + pQAG = new QActionGroup( pQMenu ); + pQAG->setExclusive(true); + } + pQAG->addAction( pAction ); + } connect( pAction, &QAction::triggered, this, [this, pSalMenuItem]{ DispatchCommand(pSalMenuItem); } ); |