vcl/qt5/QtMenu.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
New commits: commit d446be648385a451c60ba3bd1657906f72a63e75 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Apr 12 16:41:38 2023 +0300 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Apr 12 17:07:21 2023 +0200 qt: Don't show non-visible menu entries Take the visibility of the menu item (that e.g. gets set in `QtMenu::ShowItem`) into account when updating the menu in `QtMenu::DoFullMenuUpdate`. With this in place, only the relevant entry is shown in the context menu for items in the character table in the special characters dialog (Writer: "Insert" -> "Special Character") while previously, the "Add to favorites" and "Remove from favorites" entries would both be shown at the same time regardless of whether the character was present in the favorites or not. (Both entries would actually do the same: add the character if it was not present in the favorites, remove it if it was already there...). Change-Id: Ica5f07d6009d97db2df0540293b096565bf1dd52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150285 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx index fe281d6d2369..dca03050c30e 100644 --- a/vcl/qt5/QtMenu.cxx +++ b/vcl/qt5/QtMenu.cxx @@ -478,7 +478,8 @@ void QtMenu::DoFullMenuUpdate(Menu* pMenuBar) const bool bShowDisabled = bool(pMenuBar->GetMenuFlags() & MenuFlags::AlwaysShowDisabledEntries) || !bool(pMenuBar->GetMenuFlags() & MenuFlags::HideDisabledEntries); - const bool bVisible = bShowDisabled || mpVCLMenu->IsItemEnabled(pSalMenuItem->mnId); + const bool bVisible = pSalMenuItem->mbVisible + && (bShowDisabled || mpVCLMenu->IsItemEnabled(pSalMenuItem->mnId)); pSalMenuItem->getAction()->setVisible(bVisible); if (pSalMenuItem->mpSubMenu != nullptr)
