Results 1 to 4 of 4

Thread: Remove widget from layout

  1. #1
    Join Date
    Feb 2011
    Location
    Latvia
    Posts
    139
    Thanks
    24
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Remove widget from layout

    So i have a layout. I added many different widgets to it. But i want to know, how do i remove a widget from layout? I tried:
    layout->removeWidget(returnButton);
    Program compiles and everything, but when the time comes - the widget does not disappear... help?

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Remove widget from layout

    to remove the widget to need to re-parent it or delete it or just hide() it.

  3. #3
    Join Date
    Feb 2011
    Location
    Latvia
    Posts
    139
    Thanks
    24
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Remove widget from layout

    Hm.. i need to use it later, so i think i'll have to use hide()...

  4. #4
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Remove widget from layout

    So i have a layout. I added many different widgets to it. But i want to know, how do i remove a widget from
    layout? I tried:
    layout->removeWidget(returnButton);
    Program compiles and everything, but when the time comes - the widget does not disappear... help?
    hi,
    try returnButton->setParent(0);
    Bala

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

    Archa4 (17th February 2011)

Similar Threads

  1. mainwindow layout vs widget layout
    By fatecasino in forum Newbie
    Replies: 2
    Last Post: 14th December 2010, 14:45
  2. Remove widgets in a Layout
    By jayreddy in forum Qt Programming
    Replies: 2
    Last Post: 4th December 2009, 10:21
  3. Remove widget from a QList
    By Eos Pengwern in forum Newbie
    Replies: 4
    Last Post: 16th October 2009, 21:25
  4. remove widgets from layout in run time
    By bindigi01 in forum Qt Programming
    Replies: 10
    Last Post: 6th June 2009, 22:36
  5. Remove Widget Border?
    By winston2020 in forum Qt Programming
    Replies: 5
    Last Post: 20th October 2008, 05:26

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.