vcl/qt5/Qt5Menu.cxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
New commits: commit d81634d3815c2c4e0acdf26811afbe656bc98fb9 Author: Katarina Behrens <katarina.behr...@cib.de> Date: Tue May 29 09:53:43 2018 +0200 Add radiobuttons to native menus Change-Id: I015bbb0a337b917096ca6f542a73c24c79fbef7d 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); } ); commit 1cd7a03876f665289c4e4a6b9f4cb73fc54d987a Author: Katarina Behrens <katarina.behr...@cib.de> Date: Mon May 28 13:59:43 2018 +0200 Add checkmark buttons to native menus Change-Id: If64227af287006cb4f9b980dac97b2fb401eac88 diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx index 91de0defccff..6c219aff7557 100644 --- a/vcl/qt5/Qt5Menu.cxx +++ b/vcl/qt5/Qt5Menu.cxx @@ -96,6 +96,8 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu ) QMenu* pQMenu = pParentMenu; NativeItemText( aText ); vcl::KeyCode nAccelKey = pVCLMenu->GetAccelKey( nId ); + bool bChecked = pVCLMenu->IsItemChecked( nId ); + MenuItemBits itemBits = pVCLMenu->GetItemBits( nId ); if (mbMenuBar && mpQMenuBar) // top-level menu @@ -114,6 +116,13 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu ) // leaf menu QAction *pAction = pQMenu->addAction( toQString(aText) ); pAction->setShortcut( toQString( nAccelKey.GetName(GetFrame()->GetWindow()) ) ); + + if (itemBits & MenuItemBits::CHECKABLE) + { + pAction->setCheckable( true ); + pAction->setChecked( bChecked ); + } + connect( pAction, &QAction::triggered, this, [this, pSalMenuItem]{ DispatchCommand(pSalMenuItem); } ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits