[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - 2 commits - vcl/inc vcl/qt5
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Jan 14 06:55:01 UTC 2019
vcl/inc/qt5/Qt5Menu.hxx | 2 +-
vcl/qt5/Qt5Menu.cxx | 23 +++++++++++++++++------
2 files changed, 18 insertions(+), 7 deletions(-)
New commits:
commit 9ddf669ee1a4490cfbfe0d7166ce7effcc717074
Author: Aleksei Nikiforov <darktemplar at basealt.ru>
AuthorDate: Thu Jan 10 15:54:56 2019 +0300
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Jan 14 07:54:52 2019 +0100
Unregister action when menu item is removed
Change-Id: I9fc5e6630560f285eeb7ef4dbc5e39ccabd5f0df
Reviewed-on: https://gerrit.libreoffice.org/66147
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
(cherry picked from commit 35b59e56cc01e5ecf97583ab7b7884d301457089)
Reviewed-on: https://gerrit.libreoffice.org/66172
Reviewed-by: Aleksei Nikiforov <darktemplar at basealt.ru>
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index d92c0c0e3a8b..6aa201f7ad30 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -185,7 +185,15 @@ void Qt5Menu::InsertItem(SalMenuItem* pSalMenuItem, unsigned nPos)
void Qt5Menu::RemoveItem(unsigned nPos)
{
SolarMutexGuard aGuard;
- maItems.erase(maItems.begin() + nPos);
+
+ if (nPos < maItems.size())
+ {
+ Qt5MenuItem* pItem = maItems[nPos];
+ pItem->mpAction.reset();
+ pItem->mpMenu.reset();
+
+ maItems.erase(maItems.begin() + nPos);
+ }
}
void Qt5Menu::SetSubMenu(SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned)
commit b6704c14ce2241e76904e494125a520814ec5021
Author: Aleksei Nikiforov <darktemplar at basealt.ru>
AuthorDate: Thu Jan 10 15:54:56 2019 +0300
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Jan 14 07:54:39 2019 +0100
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: Thorsten Behrens <Thorsten.Behrens at CIB.de>
(cherry picked from commit c278857137ea0e9e25613d5f6bf8ddaf1336fbcc)
Reviewed-on: https://gerrit.libreoffice.org/66173
Reviewed-by: Aleksei Nikiforov <darktemplar at basealt.ru>
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx
index 9f7469fa3f78..b3b06bfeabac 100644
--- a/vcl/inc/qt5/Qt5Menu.hxx
+++ b/vcl/inc/qt5/Qt5Menu.hxx
@@ -33,7 +33,7 @@ private:
QMenu* mpQMenu;
QActionGroup* mpQActionGroup;
- void DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu = nullptr);
+ void DoFullMenuUpdate(Menu* pMenuBar);
static void NativeItemText(OUString& rItemText);
QMenu* InsertMenuItem(Qt5MenuItem* pSalMenuItem, unsigned nPos);
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 130d7c583f58..d92c0c0e3a8b 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -219,18 +219,17 @@ void Qt5Menu::SetFrame(const SalFrame* pFrame)
if (pMainWindow)
{
mpQMenuBar = pMainWindow->menuBar();
+ mpQMenu = nullptr;
+ mpQActionGroup = nullptr;
DoFullMenuUpdate(mpVCLMenu);
}
}
-void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu)
+void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar)
{
- mpQMenu = pParentMenu;
-
if (mbMenuBar && mpQMenuBar)
mpQMenuBar->clear();
- mpQActionGroup = nullptr;
for (sal_Int32 nItem = 0; nItem < static_cast<sal_Int32>(GetItemCount()); nItem++)
{
@@ -240,8 +239,12 @@ void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu)
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());
- pSalMenuItem->mpSubMenu->DoFullMenuUpdate(pMenuBar, pQMenu);
+ pSalMenuItem->mpSubMenu->DoFullMenuUpdate(pMenuBar);
pMenuBar->HandleMenuDeActivateEvent(pSalMenuItem->mpSubMenu->GetMenu());
}
}
More information about the Libreoffice-commits
mailing list