Results 1 to 3 of 3

Thread: Do I need to destroy the widget of setItemWidget?

  1. #1
    Join Date
    Mar 2010
    Location
    Heredia, Costa Rica
    Posts
    257
    Thanks
    24
    Thanked 17 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Question Do I need to destroy the widget of setItemWidget?

    Hi,

    I am adding widgets to the items of a QTreeWidget. The documentation of setItemWidget says:

    The tree takes ownership of the widget.

    Does this means that when the QTreeWidget gets destroyed it destroy the item widget?

    Thanks,
    Carlos.

  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: Do I need to destroy the widget of setItemWidget?

    Yes, that's correct.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    qlands (30th May 2011)

  4. #3
    Join Date
    Apr 2011
    Posts
    124
    Thanks
    1
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: Do I need to destroy the widget of setItemWidget?

    Right. Whenever an object "takes ownership" of another object, it takes over responsibility for deleting the object when appropriate.

Similar Threads

  1. Replies: 2
    Last Post: 3rd February 2011, 10:07
  2. Replies: 0
    Last Post: 29th November 2010, 05:34
  3. Replies: 7
    Last Post: 19th October 2010, 08:32
  4. Replies: 2
    Last Post: 7th June 2008, 13:12
  5. Replies: 1
    Last Post: 24th June 2006, 20:55

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.