Bug 151421 - KStandardAction::showMenuBar() only working when action is in toolbar/menu etc,
Summary: KStandardAction::showMenuBar() only working when action is in toolbar/menu etc,
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: kdelibs bugs
: 151517 152240 152508 152519 152731 (view as bug list)
Depends on:
Reported: 2007-10-27 11:23 UTC by Linus Östberg
Modified: 2007-12-07 12:54 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Linus Östberg 2007-10-27 11:23:03 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc version 4.1.3 20070929 (prerelease) 
OS:                Linux

The showMenuBar() standard action is only working when it's available in a toolbar, in the menu  etc. 

This means that when the menu is hidden, and the action is not available in a toolbar, it's impossible to get it back, as the shortcut is not working. I usually add the action to a toolbar when I do this by accident.

It has only been tested in Kubuntu 7.10 with SVN sources for KDE 4.
Comment 1 Urs Wolfer 2007-11-09 08:25:56 UTC
*** Bug 151517 has been marked as a duplicate of this bug. ***
Comment 2 David Faure 2007-11-12 00:24:59 UTC
Andreas, any idea why a hidden menubar breaks the KAction's shortcuts? Testcase: Ctrl+M in konqueror, try to Ctrl+M again.

I guess this is somehow related to the shortcut context, since QAction::setShortcut() works fine for actions that are not plugged anywhere (using the default shortcut context)...

Is this something that Qt-4.4's shortcut context improvements should fix?
Comment 3 Hamish Rodda 2007-11-12 04:23:44 UTC
I reported this bug to Trolltech in March: see 

Unfortunately it has been deemed the intended behaviour.

So, we probably need to add all menu actions to the top level widget when the 
menubar is shown, if we want the shortcuts to work (bummer).

Any other ideas of how we could make this work?

Comment 4 Pino Toscano 2007-11-13 11:58:30 UTC
*** Bug 152240 has been marked as a duplicate of this bug. ***
Comment 5 Thomas Zander 2007-11-13 12:10:25 UTC
Try adding the action to the 'canvas'. (using addAction())
Comment 6 Urs Wolfer 2007-11-18 20:45:41 UTC
*** Bug 152508 has been marked as a duplicate of this bug. ***
Comment 7 Thomas McGuire 2007-11-18 20:54:05 UTC
*** Bug 152519 has been marked as a duplicate of this bug. ***
Comment 8 Thomas Zander 2007-11-18 23:05:19 UTC
SVN commit 738433 by zander:

Add the hide action before we set the xmlguiclient so the action is found when
making the menu.
BUG: 151421

 M  +1 -1      MainWindow.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=738433
Comment 9 FiNeX 2007-11-18 23:27:09 UTC
Well done Thomas!
Comment 10 FiNeX 2007-11-19 15:44:19 UTC
Ahem, there is a SMALL problem, you should have fix the problem in konsole but
1) in konsole the shortcut is not even working
2) the problem is not ONLY in konsole, but in EVERY apps who has hiddable menubars!!!!

The bug is NOT fixed.

Comment 11 Thomas Zander 2007-11-19 16:00:20 UTC
Apparantly someone merged the konsole bug 152240 with this one by mistake as they were different things...  Sorry for closing this one without reading the full text.
Comment 12 FiNeX 2007-11-19 16:06:25 UTC
np Thomas :-)
Comment 13 Thomas McGuire 2007-11-19 18:11:53 UTC
*** Bug 152519 has been marked as a duplicate of this bug. ***
Comment 14 Thomas Zander 2007-11-20 14:05:34 UTC
I fixed the problem in kactioncollection locally, but it still requires qt4.4 to actually work. (which means its probably a long term solution)
I wrote a mail to kde-core-devel about the problem in the kactioncollection, lets see what happens there.
But, yeah, I can now use 'ctrl-alt-N' to get a new shell in konsole, even while there is no menu visible ;)
Comment 15 Pino Toscano 2007-11-22 20:30:40 UTC
*** Bug 152731 has been marked as a duplicate of this bug. ***
Comment 16 Will Stephenson 2007-11-22 22:36:55 UTC
*** Bug 152680 has been marked as a duplicate of this bug. ***
Comment 17 Hamish Rodda 2007-12-03 16:22:16 UTC
SVN commit 744418 by rodda:

Replace KAction::associateWidget() with a set of methods to permanently associate / dissociate a widget with an action collection.  This does 
not change the shortcut context, in contrast to the methods that I removed about a month ago; this approach was thought to be ok (in 
comparison to the one I removed) because it does not cause modification of the actions being added to the collection.

Also, add all xmlgui client actions to the top level main window.

These two changes fix bug 151421 and duplicates / related bugs.

It is BIC as I have removed the old associateWidget(), for which I will commit patches to the rest of KDE which use it now.


 M  +15 -2     kate/view/kateview.cpp  
 M  +47 -15    kdeui/actions/kactioncollection.cpp  
 M  +23 -8     kdeui/actions/kactioncollection.h  
 M  +8 -1      kdeui/dialogs/kedittoolbar.cpp  
 M  +1 -1      kdeui/tests/kactioncollectiontest.cpp  
 M  +1 -1      kdeui/tests/ktoolbartest.cpp  
 M  +8 -1      kdeui/widgets/kdatetable.cpp  
 M  +6 -12     kdeui/xmlgui/kxmlguiclient.cpp  
 M  +4 -1      kfile/kdiroperator.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=744418
Comment 18 FiNeX 2007-12-03 16:47:42 UTC
The patch works correctly: I've tried konsole, dolphin and konqueror and NOW shortucs works even with the menu bar hidden.

Thanks Hamish :-) :-)
Comment 19 Linus Östberg 2007-12-03 19:25:05 UTC
Just had to say thanks, works perfectly for me now.