December 17, 2011

Seba84 Seba84
Lab Rat
72 posts

[Solved] QMdiSubWindow deletes internal widget on close?

 

Hello everyone,

I have some questions:

  1. Does QMdiSubWindow deletes the internal widget on close?
  2. Does it delete the widget when ~QMdiSubWindow() is called?
  3. Does the widget get destroyed before program exit, or can I expect memory leakage?

On documentation internal widget destruction time isn’t very clear, and neither when ~QMdiSubWindow() is called.

Thanks in advance!
Cheers,
Seba84

2 replies

December 17, 2011

Chris H Chris H
Lab Rat
139 posts
  1. On close, it hides itself, unless you tell it to delete on close via the Qt::WA_DeleteOnClose attribute, same as any other window.
  2. Again like any other widget, it will cause its children to be deleted when it is deleted.
  3. It does (usually), but even if it didn’t, the OS will reclaim the memory, so it’s not like you will have a memory leak once the program is shut down.

December 18, 2011

Seba84 Seba84
Lab Rat
72 posts

Thanks Chris!

 
  ‹‹ HTML inside QPushButton - how to insert images?      removeRow() method of a QSqlTableModel object ››

You must log in to post a reply. Not a member yet? Register here!