Results 1 to 3 of 3

Thread: setVisible(false) doesn't work

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2008
    Location
    Karaj,Iran
    Posts
    43
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default setVisible(false) doesn't work

    I'm trying to temporarily hide a QMenu which contains some actions ,but
    ui.menu_management->setVisible(false); doesn't seem to work,how can I approach this?
    ---
    A situtation never gets so complicated that it can't get any more complicated!

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: setVisible(false) doesn't work

    Why do you have the menu on the heap as a member variable in the first place? Wouldn't it be better to create it on the stack once needed, execute it, and let it go out of scope? Something like what is shown in QMenu::exec() docs.
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    sepehr (4th February 2009)

  4. #3
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: setVisible(false) doesn't work

    try
    Qt Code:
    1. ui.menu_management->menuAction()->setVisible(false);
    To copy to clipboard, switch view to plain text mode 
    the ";" after a class decl is needed because C allows you to write stuff like
    struct hello {
    int i;
    } an_object_of_type_hello;

    saving you the trouble of writing the impossibly long
    struct hello an_object_of_type_hello;

  5. The following user says thank you to caduel for this useful post:

    sepehr (4th February 2009)

Similar Threads

  1. Qt4 : QPainter::setRedirected doesn't work
    By Ankitha Varsha in forum Qt Programming
    Replies: 2
    Last Post: 20th June 2008, 17:52
  2. QActions don't work with menubar hidden
    By Pepe in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2007, 01:04
  3. Change work area OS
    By pakulo in forum Qt Programming
    Replies: 15
    Last Post: 15th May 2007, 07:20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.