Results 1 to 2 of 2

Thread: Delete content widget in layout

  1. #1
    Join Date
    Feb 2010
    Location
    Cuba
    Posts
    35
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Delete content widget in layout

    Hi
    I'm trying to delete a widget or several widgets content in a QBoxLayout. How can I do this?

    This is my code:

    Qt Code:
    1. void CustomRadioButton::deleteOption(int pos)
    2. {
    3. if(pos >= 0 && pos < getLayout()->count())
    4. {
    5. delete getLayout()->takeAt(pos);
    6. update();
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 

    I think I managed to delete the widget, but the layout do not updated visually. Any idea??
    Thanks in advanced and excuse my English.
    Last edited by high_flyer; 17th December 2010 at 16:12. Reason: code tags

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    99
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Delete content widget in layout

    from the docs :
    http://doc.qt.nokia.com/4.7/qboxlayout.html

    QBoxLayout Class Reference says :

    To remove a widget from a layout, call removeWidget(). Calling QWidget::hide() on a widget also effectively removes the widget from the layout until QWidget::show() is called.

    So it's there already.

    Have fun.

    everall

Similar Threads

  1. mainwindow layout vs widget layout
    By fatecasino in forum Newbie
    Replies: 2
    Last Post: 14th December 2010, 14:45
  2. Replies: 2
    Last Post: 2nd November 2010, 01:43
  3. Delete Layout and its childs
    By jano_alex_es in forum Newbie
    Replies: 1
    Last Post: 8th May 2009, 12:23
  4. delete layout() / setLayout issue
    By vlg789 in forum Qt Programming
    Replies: 5
    Last Post: 21st September 2007, 17:25
  5. Replies: 7
    Last Post: 15th June 2007, 16:13

Tags for this Thread

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.