diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-05-25 16:04:24 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-06-01 10:06:33 +0200 |
commit | 26bcf9610f74b7d8e4c5894ffe4da7f581191dd8 (patch) | |
tree | fc7ec6d1ce294573f3e61bea7a4672ef3723f3e8 /vcl/qt5 | |
parent | b971f2cc18ff3ad46e1bb27ba983ea0a4bbb3be2 (diff) |
Dispatch commands from menus for real
Change-Id: I01997caa22e14c1350bd83100edb74397ebab5d7
Diffstat (limited to 'vcl/qt5')
-rw-r--r-- | vcl/qt5/Qt5Menu.cxx | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx index f7ebc5617d8c..91de0defccff 100644 --- a/vcl/qt5/Qt5Menu.cxx +++ b/vcl/qt5/Qt5Menu.cxx @@ -114,7 +114,8 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu ) // leaf menu QAction *pAction = pQMenu->addAction( toQString(aText) ); pAction->setShortcut( toQString( nAccelKey.GetName(GetFrame()->GetWindow()) ) ); - connect( pAction, &QAction::triggered, this, &Qt5Menu::DispatchCommand ); + connect( pAction, &QAction::triggered, this, + [this, pSalMenuItem]{ DispatchCommand(pSalMenuItem); } ); } } } @@ -156,6 +157,14 @@ void Qt5Menu::GetSystemMenuData( SystemMenuData* pData ) { } +Qt5Menu* Qt5Menu::GetTopLevel() +{ + Qt5Menu *pMenu = this; + while (pMenu->mpParentSalMenu) + pMenu = pMenu->mpParentSalMenu; + return pMenu; +} + const Qt5Frame* Qt5Menu::GetFrame() const { SolarMutexGuard aGuard; @@ -165,9 +174,15 @@ const Qt5Frame* Qt5Menu::GetFrame() const return pMenu ? pMenu->mpFrame : nullptr; } -void Qt5Menu::DispatchCommand() +void Qt5Menu::DispatchCommand( Qt5MenuItem *pQItem ) { - SAL_WARN("vcl.qt5", "menu triggered"); + if ( pQItem ) + { + Qt5Menu* pSalMenu = pQItem->mpParentMenu; + Qt5Menu* pTopLevel = pSalMenu->GetTopLevel(); + pTopLevel->GetMenu()->HandleMenuCommandEvent(pSalMenu->GetMenu(), pQItem->mnId); + SAL_WARN("vcl.qt5", "menu triggered " << pQItem->mnId ); + } } void Qt5Menu::NativeItemText( OUString& rItemText ) |