If you create more than one window inside of main(), how do destroy all of them when the main window is closed by the user? So he does not have to close all windows manually?

Code example:
Qt Code:
  1. #ifndef CLOSETEST_H
  2. #define CLOSETEST_H
  3. #include <QtGui>
  4.  
  5. class CloseTest : public QWidget {
  6.  
  7. public:
  8. CloseTest(QWidget *parent = 0);
  9. };
  10.  
  11. #endif
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. #include "CloseTest.h"
  2.  
  3. CloseTest::CloseTest(QWidget *parent)
  4. {
  5. QHBoxLayout *layout = new QHBoxLayout;
  6. QLabel *label = new QLabel("This is a test");
  7.  
  8. layout->addWidget(label);
  9. setLayout(layout);
  10. }
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. #include <QApplication>
  2. #include "CloseTest.h"
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6. QApplication app(argc, argv);
  7.  
  8. QLabel main("This is the main label");
  9. main.resize(300,150);
  10. main.show();
  11.  
  12. CloseTest ct;
  13. ct.show();
  14.  
  15. return app.exec();
  16. }
To copy to clipboard, switch view to plain text mode