Results 1 to 2 of 2

Thread: What to free or not to free, that is the question

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What to free or not to free, that is the question

    Everything seems OK with your code.
    Also take a look at: http://www.qtcentre.org/forum/f-qt-p...ion--5956.html

    Generally you don't need to delete widgets, only in special cases when you allocate temporary widgets without a parent on the heap.

    Also you might allocate QObject's on the heap, like a QList, QThread,ect. These are better to explicitly be deleted when finished using.

    About setIcon: you can only pass a reference to this function, so if you have something like this:
    Qt Code:
    1. QIcon *icon = new QIcon(...);
    2. setIcon(*icon);
    3.  
    4. ...
    5. delete icon;
    To copy to clipboard, switch view to plain text mode 
    You must delete the icon, since the for which you set it owns a copy of your icon.

    Regards
    Regards

  2. The following user says thank you to marcel for this useful post:

    bruccutler (27th July 2007)

Similar Threads

  1. Legal question about QT free edition
    By probine in forum General Discussion
    Replies: 10
    Last Post: 5th May 2007, 19: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
  •  
Qt is a trademark of The Qt Company.