diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-05-28 13:59:43 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-06-01 10:06:33 +0200 |
commit | 42b390cb0131d867e89888d879e34025658e99c2 (patch) | |
tree | 30c38ad1409f770f88b4a4eae856f74769f7af33 /vcl/qt5 | |
parent | 26bcf9610f74b7d8e4c5894ffe4da7f581191dd8 (diff) |
Add checkmark buttons to native menus
Change-Id: If64227af287006cb4f9b980dac97b2fb401eac88
Diffstat (limited to 'vcl/qt5')
-rw-r--r-- | vcl/qt5/Qt5Menu.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
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); } ); } |