Results 1 to 3 of 3

Thread: Qt::WA_DeleteOnClose not on by default

  1. #1
    Join Date
    May 2013
    Posts
    45
    Thanks
    6
    Thanked 6 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Qt::WA_DeleteOnClose not on by default

    Why does QWidget not have Qt::WA_DeleteOnClose attribute on by default? Ie Why is the widget not deleted when the widget is closed (On the heap)?
    Last edited by scarecr0w132; 7th June 2015 at 13:33.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt::WA_DeleteOnClose not on by default

    Often you do not want that behaviour. Think about hiding/showing a non-modal toolbox window for example. You could construct it and set it to match the program state every time it is shown (the delete on close case) or construct it once and have it stay in sync with the program state whether hidden or not.

  3. #3
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt::WA_DeleteOnClose not on by default

    Besides, the vast majority of widgets are children of other widgets; their lifetime is controlled by their parent, therefore Qt::WA_DeleteOnClose is better left off for them.

Similar Threads

  1. Replies: 2
    Last Post: 13th October 2013, 09:47
  2. WA_DeleteOnClose and exec()
    By Wasabi in forum Newbie
    Replies: 6
    Last Post: 7th August 2011, 05:54
  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

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.