Results 1 to 4 of 4

Thread: Delete objects in Designer

  1. #1
    Join Date
    Jul 2007
    Posts
    57
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Delete objects in Designer

    Is there any way to delete objects created using desgner.I hav an application that makes use of a dialog created using Designer.There is some leak in my app so i tried deleting objects in the destructor.But there is no change in memory leak..Any ideas??

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Delete objects in Designer

    A QObject deletes its children. All child widgets in the dialog get deleted when the dialog itself is deleted. You just have to make sure the dialog gets properly destructed. Notice that it's preferred to allocate a modal dialog on the stack so it gets automatically destructed when going out of scope.
    J-P Nurmi

  3. #3
    Join Date
    Jul 2007
    Posts
    57
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Delete objects in Designer

    I am trying to delete the object in the class its being created.I am giving destroy() in the
    close event ,does it mean its deleted ..Does Qt take care of the deletion???

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Delete objects in Designer

    Use C++ delete operator. You don't need to call QWidget::destroy(), it gets called by QWidget destructor.
    J-P Nurmi

Similar Threads

  1. QT Designer? Coding by hand?
    By lewis in forum Qt Tools
    Replies: 47
    Last Post: 2nd April 2007, 16:30
  2. Replies: 13
    Last Post: 15th December 2006, 11:52
  3. c++, placement delete upon exception
    By stinos in forum General Programming
    Replies: 6
    Last Post: 31st October 2006, 15:38

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.