Le 17/12/2015 22:06, Guillaume Munch a écrit :
Le 17/12/2015 21:45, Scott Kostyshak a écrit :
On Thu, Dec 17, 2015 at 08:42:50PM +0000, Guillaume Munch wrote:

Scott probably meant to link to http://www.lyx.org/trac/ticket/9717.

Scott's patch was meant to let us see the contents of greyed-out
(disabled) Submenus, but had the side-effect of always showing the
OptSubmenus too, so there was no more distinction between the two
(apart
in the odd case of an empty OptSubmenu).

The "patch" (just a code sketch written in the browser) amounts to the
attached, the logic of which I am more convinced with now. So I lied
in the other message, my last patch for 2.2.0 is this one.

Seems sensible, though I did not have time to test.


Ok, I'll be waiting for +1.

I had tested so I think combined with Richard's "Seems sensible (in
theory)" we have a +1.


We have a +1! It's in!

But, I just noticed that there is a similar issue with the Edit > Math
OptSubmenu. My patch did not fix this case, because its submenus are
always enabled now, the OptSubmenu believes that it has some enabled
elements, while it truly does not.




Here's a better solution.
>From 5674684e53d5092ee2589db7e8dc2ba151a26dae Mon Sep 17 00:00:00 2001
From: Guillaume Munch <g...@lyx.org>
Date: Thu, 17 Dec 2015 22:26:50 +0000
Subject: [PATCH] Hide OptSubmenus (#9717) (for real this time)

Amend 6cc69343 and d449e7e6. See the latter for the rationale behind this
change.
---
 src/frontends/qt4/Menus.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp
index 1076144..ea32aac 100644
--- a/src/frontends/qt4/Menus.cpp
+++ b/src/frontends/qt4/Menus.cpp
@@ -419,7 +419,7 @@ void MenuDefinition::addWithStatusCheck(MenuItem const & i)
 				if ((cit->kind() == MenuItem::Command
 				     || cit->kind() == MenuItem::Submenu
 				     || cit->kind() == MenuItem::Help)
-				    && (!i.optional() || cit->status().enabled())) {
+				    && cit->status().enabled()) {
 					enabled = true;
 					break;
 				}
@@ -1771,7 +1771,7 @@ void Menu::Impl::populate(QMenu & qMenu, MenuDefinition const & menu)
 		else if (m->kind() == MenuItem::Submenu) {
 			QMenu * subMenu = qMenu.addMenu(label(*m));
 			populate(*subMenu, m->submenu());
-			subMenu->setEnabled(m->status().enabled());
+			subMenu->setEnabled(!subMenu->isEmpty());
 		} else {
 			// we have a MenuItem::Command
 			qMenu.addAction(new Action(QIcon(), label(*m),
-- 
2.1.4

Reply via email to