Kaydet (Commit) c2788571 authored tarafından Aleksei Nikiforov's avatar Aleksei Nikiforov Kaydeden (comit) Thorsten Behrens

tdf#122253 KDE5: Correct parent menu before it's used

Also correct action group of menu

Change-Id: Ie7eddd3cdc9fa1c36fdeaa1e96eb5d50d7126c09
Reviewed-on: https://gerrit.libreoffice.org/66146
Tested-by: Jenkins
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 35b59e56
...@@ -36,7 +36,7 @@ private: ...@@ -36,7 +36,7 @@ private:
QMenu* mpQMenu; QMenu* mpQMenu;
QActionGroup* mpQActionGroup; QActionGroup* mpQActionGroup;
void DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu = nullptr); void DoFullMenuUpdate(Menu* pMenuBar);
static void NativeItemText(OUString& rItemText); static void NativeItemText(OUString& rItemText);
QMenu* InsertMenuItem(Qt5MenuItem* pSalMenuItem, unsigned nPos); QMenu* InsertMenuItem(Qt5MenuItem* pSalMenuItem, unsigned nPos);
......
...@@ -227,18 +227,17 @@ void Qt5Menu::SetFrame(const SalFrame* pFrame) ...@@ -227,18 +227,17 @@ void Qt5Menu::SetFrame(const SalFrame* pFrame)
if (pMainWindow) if (pMainWindow)
{ {
mpQMenuBar = pMainWindow->menuBar(); mpQMenuBar = pMainWindow->menuBar();
mpQMenu = nullptr;
mpQActionGroup = nullptr;
DoFullMenuUpdate(mpVCLMenu); DoFullMenuUpdate(mpVCLMenu);
} }
} }
void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu) void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar)
{ {
mpQMenu = pParentMenu;
if (mbMenuBar && mpQMenuBar) if (mbMenuBar && mpQMenuBar)
mpQMenuBar->clear(); mpQMenuBar->clear();
mpQActionGroup = nullptr;
for (sal_Int32 nItem = 0; nItem < static_cast<sal_Int32>(GetItemCount()); nItem++) for (sal_Int32 nItem = 0; nItem < static_cast<sal_Int32>(GetItemCount()); nItem++)
{ {
...@@ -248,8 +247,12 @@ void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu) ...@@ -248,8 +247,12 @@ void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu)
if (pSalMenuItem->mpSubMenu != nullptr) if (pSalMenuItem->mpSubMenu != nullptr)
{ {
// correct parent menu and action group before calling HandleMenuActivateEvent
pSalMenuItem->mpSubMenu->mpQMenu = pQMenu;
pSalMenuItem->mpSubMenu->mpQActionGroup = nullptr;
pMenuBar->HandleMenuActivateEvent(pSalMenuItem->mpSubMenu->GetMenu()); pMenuBar->HandleMenuActivateEvent(pSalMenuItem->mpSubMenu->GetMenu());
pSalMenuItem->mpSubMenu->DoFullMenuUpdate(pMenuBar, pQMenu); pSalMenuItem->mpSubMenu->DoFullMenuUpdate(pMenuBar);
pMenuBar->HandleMenuDeActivateEvent(pSalMenuItem->mpSubMenu->GetMenu()); pMenuBar->HandleMenuDeActivateEvent(pSalMenuItem->mpSubMenu->GetMenu());
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment