[Qt-interest] How to hide an "easter egg" QMenu ?
Tony Rietwyk
tony.rietwyk at rightsoft.com.au
Fri Jun 4 15:52:18 CEST 2010
> -----Original Message-----
> I can make the action invisible, but the menu I cannot. I tried:
>
> ui->actionTestThrowException->setVisible(false);
> ui->menuTest->setVisible(false);
> ui->menuTest->setHidden(true);
> ui->menuTest->hide();
>
> I have a secret "Test" menu that I want to display for debug
> and test purposes via a secret key command (easter egg) or
> config file.
>
> Thanks in advance for any tips or direction,
>
> -Ed
Hi Ed,
I'm pretty sure I hit the same problem.
If you create the menu in code, then you also need to store the action that
you receive when you add the menu. Otherwise make sure the action has a
decent name in designer - say testMenuAction.
Then call ui.testMenuAction->setVisible( false );
My understanding is that even though menus inherit from QWidget, the
associated action overrules the properties that it shares with the menu and
toolbar widgets.
Hope that helps
Tony.
More information about the Qt-interest-old
mailing list