Hi!

I have a problem with a dialog window that doesn't close when I close the MainWindow. The dialog isn't modal, because I want a window at the side of my main window that I can display state of the progam.

I've read about parents and childs and thought that a child is closed when it's parent is. So either I've got this wrong or I've failed making the dialog a child to the main window.

Heres a shortened version of the code:


This is the dialog class:
Qt Code:
  1. class OutlinerEditor : public QDialog
  2. {
  3. Q_OBJECT
  4.  
  5.  
  6. public:
  7.  
  8. OutlinerEditor ( std::vector<Renderable*> *v,
  9. std::vector<Renderable*> *s,
  10. QWidget *parent ):
  11. QDialog ( parent )
  12. {
  13. setWindowTitle ( "Outliner" );
  14.  
  15. treeModel = new TreeModel ( cmps );
  16.  
  17. outliner = new Outliner ( sels, this );
  18. outliner->setModel ( treeModel );
  19. outliner->connectSelection ( );
  20.  
  21. hLayout = new QHBoxLayout ( this );
  22. hLayout->addWidget ( outliner );
  23.  
  24. hLayout->setMargin ( 1 );
  25. setContentsMargins ( 1, 1, 1, 1 );
  26.  
  27. // and connections and so forth...
  28.  
  29. }// OutlinerEditor(v*,v*,W*)
  30.  
  31. };// class OutlinerEditor
To copy to clipboard, switch view to plain text mode 


This is the MainWindow class:
Qt Code:
  1. class MainWindow : public QMainWindow
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. MainWindow::MainWindow ( ):
  7. {
  8. canvasFrame = new CanvasFrame;
  9.  
  10. /* This is where I build the dialog and connects it, the last argument is the
  11.   * pointer to the parent.
  12.   */
  13. OutlinerEditor *outlinerEditor = new OutlinerEditor ( NULL, NULL, this );
  14.  
  15. /* This is how I show the dialog as not modal */
  16. outlinerEditor->show ( );
  17.  
  18. }// MainWindow()
  19.  
  20. };// class MainWindow
To copy to clipboard, switch view to plain text mode 


thanks for reading
pir