diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/qt5/Qt5Menu.hxx | 2 | ||||
-rw-r--r-- | vcl/qt5/Qt5Menu.cxx | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx index bbd18709ce51..f3111d01aa8a 100644 --- a/vcl/inc/qt5/Qt5Menu.hxx +++ b/vcl/inc/qt5/Qt5Menu.hxx @@ -60,7 +60,7 @@ public: Qt5MenuItem* GetItemAtPos(unsigned nPos) { return maItems[nPos]; } private slots: - void DispatchCommand(Qt5MenuItem* pQItem); + void slotMenuTriggered(Qt5MenuItem* pQItem); }; class Qt5MenuItem : public SalMenuItem diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx index c7abd17c30d2..9bbf86be6688 100644 --- a/vcl/qt5/Qt5Menu.cxx +++ b/vcl/qt5/Qt5Menu.cxx @@ -138,7 +138,7 @@ void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu) pAction->setVisible(pSalMenuItem->mbVisible); connect(pAction, &QAction::triggered, this, - [this, pSalMenuItem] { DispatchCommand(pSalMenuItem); }); + [this, pSalMenuItem] { slotMenuTriggered(pSalMenuItem); }); } } } @@ -234,14 +234,18 @@ const Qt5Frame* Qt5Menu::GetFrame() const return pMenu ? pMenu->mpFrame : nullptr; } -void Qt5Menu::DispatchCommand(Qt5MenuItem* pQItem) +void Qt5Menu::slotMenuTriggered(Qt5MenuItem* pQItem) { if (pQItem) { Qt5Menu* pSalMenu = pQItem->mpParentMenu; Qt5Menu* pTopLevel = pSalMenu->GetTopLevel(); + + // it is possible that dispatcher of a menu entry was cleared since + // initial activation (happens e.g. when extension comes w/ its own menus + // and dispatchers) so re-activate the entry before dispatching the command + pTopLevel->GetMenu()->HandleMenuActivateEvent(pSalMenu->GetMenu()); pTopLevel->GetMenu()->HandleMenuCommandEvent(pSalMenu->GetMenu(), pQItem->mnId); - SAL_WARN("vcl.qt5", "menu triggered " << pQItem->mnId); } } |