Results 1 to 8 of 8

Thread: (Solved) Removing (replacing) central widget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Location
    Belgrade, Serbia
    Posts
    40
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default (Solved) Removing (replacing) central widget

    Maybe dumb question but I failed to google the answer so you might help.

    I have a MainWindow in my application. And two completely different widgets that I would need to use as central widget. When application starts central widget is not set. When user click new in the file menu a Dialog appears and let him choose one or the other. Depending on his choice I create the appropriate widget and using setCentralWidget make it the central widget of Main Window class.

    Now when user finish work and wants to change mode so to speak he click new again he is asked to save his work and the same Dialog appears for him to choose from.

    The previous widget needs to be removed as central widget, deleted and new one created and set. I know how to create and set the central widget but how to remove it safely and delete it safely.

    So far I had one central widget per application so MainWindow deleted it when he it self was closed.

    Thanks in advance.
    Last edited by frenk_castle; 6th December 2009 at 11:32.

Similar Threads

  1. Replies: 3
    Last Post: 19th February 2012, 11:40
  2. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  3. Replies: 2
    Last Post: 23rd March 2009, 17:26
  4. Replies: 2
    Last Post: 7th June 2008, 13:12
  5. Replacing Central Widget in Designer
    By Max Yaffe in forum Qt Tools
    Replies: 2
    Last Post: 11th July 2007, 11:41

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.