Results 1 to 3 of 3

Thread: howto dynamically remove/delete child widgets

  1. #1
    Join Date
    Feb 2006
    Posts
    23
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default qt4: howto dynamically remove/delete child widgets

    hi all,

    i'm working on a sort of thumbnail image viewer. each time a new folder is selected, images from that folder are read into QImages and are displayed via QLabels. these QLabels are childs of a normal widget i use as a sort of canvas to display the thumbs.

    my question is as follows:
    if i have let's say an initial directory containing 500 images, i'll have a container with 500 QLabels to display. if i switch to another directory with lets say only 100 images, can i get rid of the 400 QLabels i don't need? of course, i could hide() them, but can i call delete on them if they are constructed with a parent widget? (that is, if the QWidget is a child, does the dtor inform the parent that the child is about to be deleted? from the open src qwidget.cpp, it doesn't seem so...)

    thanks

    sepp
    Last edited by sepp; 22nd February 2006 at 12:53. Reason: missing qt version

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: howto dynamically remove/delete child widgets

    You may safely delete them. A deleted item detatches itself from the parent.

  3. #3
    Join Date
    Feb 2006
    Posts
    23
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: howto dynamically remove/delete child widgets

    thanks

    sepp

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.