C++ (Qt)int main(int argc, char *argv[]){ QApplication a(argc, argv); MainWindow *w = new MainWindow(); w->setAttribute(Qt::WA_DeleteOnClose); w->show(); return a.exec();}
C++ (Qt)while(!asleep()) sheep++;
C++ (Qt)connect( mainwindow, SIGNAL( destroyed() ), wid1, SLOT( close() ) );
MainWindow::~MainWindow(){ qDebug() << "main";}
C++ (Qt)setAttribute(Qt::WA_DeleteOnClose);
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){ this->setGeometry(100, 100, 800, 600); setAttribute(Qt::WA_DeleteOnClose); statusBar()->showMessage(tr("Ready"));}MainWindow::~MainWindow(){}
void MainWindow::closeEvent ( QCloseEvent * event ){ qDebug() << "close event"; if (wid1) { qobject_cast< QDockWidget* >(wid1->parent())->close(); }}