[Qt-interest] How to hide an "easter egg" QMenu ?

Ed Sutton ESutton at fescorp.com
Fri Jun 4 20:58:27 CEST 2010


Hi Tony,

Thank you for your replay.  I think I am missing something.   Maybe I am not using the proper terminology

>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.

The menus and actions were created in UI designer.  I had named the menu action "actionTestThrowException"  and the parent "menuTest".

>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

I think you are saying I need to set the visible property of the parent menu's child actions first?
Is not that what I am doing?

 ui->SetupUi(this);

  ui->actionTestThrowException->setVisible(false);
  ui->menuTest->setVisible(false);
  ui->menuTest->setHidden(true);
  ui->menuTest->hide();

The above, while it does makes the menu child actionTestThrowException invisible, the menuTest is till visible.  I noticed I can make all main menus invisible by ui->menuBar->setVisible(false) but can not figure out how to hide an individual one.

Thanks again for your time.  I hope you can put me one the right track.

-Ed




More information about the Qt-interest-old mailing list