Results 1 to 3 of 3

Thread: Difference between WA_DeleteOnClose = true and deleteLater()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Difference between WA_DeleteOnClose = true and deleteLater()

    My personal preference would be to use the widget attribute and to set it from the code that creates the dialog, i.e.
    Qt Code:
    1. MyDialog *dialog = new MyDialog(this);
    2. dialog->setAttribute(Qt::WA_DeleteOnClose, true);
    3. dialog->show();
    To copy to clipboard, switch view to plain text mode 

    The main motivation for doing it in such an explicit way is that anyone reading the code of the instatiation immediately sees that the deletion is taken care of.

    Cheers,
    _

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

    Momergil (13th October 2013)

Similar Threads

  1. WA_DeleteOnClose and exec()
    By Wasabi in forum Newbie
    Replies: 6
    Last Post: 7th August 2011, 05:54
  2. To use or not to use: deleteLater()
    By codeslicer in forum Qt Programming
    Replies: 11
    Last Post: 11th July 2009, 21:43
  3. Qt::WA_DeleteOnClose - object persistance
    By ranna in forum Qt Programming
    Replies: 0
    Last Post: 4th June 2009, 07:08
  4. Qt::WA_DeleteOnClose while a child QDialog is executed
    By nooky59 in forum Qt Programming
    Replies: 4
    Last Post: 11th July 2008, 12:45
  5. Qt::WA_DeleteOnClose
    By merlvingian in forum Newbie
    Replies: 3
    Last Post: 22nd November 2006, 18:38

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
  •  
Qt is a trademark of The Qt Company.