[Qt-interest] Toggle visibility of a QMainWindow's menu bar?

Anthony Serdyukov uksus70 at gmail.com
Tue Jan 13 09:16:59 CET 2009


Yes, actions on hidden menu and tool bars cannot be fired via shortcuts.
But adding actions to some visible (it's important) widget (as if you
want actions to be in widget's context menu) solves the problem.
Just set contextPolicy of that widget to Qt::NoContextMenu, and
everything should be fine.


2009/1/11 R. Reucher <rene.reucher at batcom-it.net>:
> On Sun January 11 2009 17:07:49 R. Reucher wrote:
>> > When I try to hide() or show() the menu bar, the main window definitely
>> > has the menu bar already setup. But thanks for your info on this. I'll
>> > try to do it this way...
>>
>> Yes, it really works with hide() and show()! I think I found the reason in
>> my code why it didn't in the first place - thanks again!
> After some tests I'd now rather say "it _basically_ works", because hide()'ing
> the menuBar() pops up another issue: all menu short cuts seem to be disabled
> while the menuBar() is hidden.
>
> Am I still missing something or is there an easy solution to this?
>
> Thansk, René
> --
> René Reucher
> rene.reucher at batcom-it.net
> http://www.batcom-it.net/
>
> The reason it's called "Grape Nuts" is that it contains "dextrose",
> which is also sometimes called "grape sugar", and also because "Grape
> Nuts" is catchier, in terms of marketing, than "A Cross Between Gerbil
> Food and Gravel", which is what it tastes like.
>                -- Dave Barry, "Tips for Writer's"
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



-- 
Regards,
Anthony




More information about the Qt-interest-old mailing list