title: How to force QWidget to be shown in a separate window?
body: <p>I have</p>
  
  <pre><code>class MyWidget : public QWidget
  {
      Q_OBJECT
  public:
      explicit MyWidget (QWidget *parent);
      // ...
  };
  
  // here is ALL the code in MyWidget constructor
  MyWidget::MyWidget(QWidget *parent)
      : QWidget(parent)
  {
      glWidget = new GLWidget(this, cluster);
  
      QHBoxLayout *mainLayout = new QHBoxLayout;
      mainLayout-&gt;addWidget(glWidget);
      setLayout(mainLayout);
  
      setWindowTitle("Visualization");
  }
  </code></pre>
  
  <p>and the main window <code>MainWindow w;</code>.</p>
  
  <p>I want</p>
  
  <ol>
  <li>to create new instances of MyWidget from <code>w</code>;</li>
  <li>that instances to be destroyed after <code>QCloseEvent</code> or with <code>w</code> (now they are destroyed only after <code>QCloseEvent</code>);</li>
  <li>that instances to appear in new windows.</li>
  </ol>
  
  <p>I am creating new instance of <code>MyWidget</code> like this:</p>
  
  <pre><code>void MainWindow::visualize()
  {
      MyWidget *widg = new MyWidget(this); // or widg = new MyWidget(0)
      widg-&gt;show();
      widg-&gt;raise();
      widg-&gt;activateWindow();
  }
  </code></pre>
  
  <p>When I try to create <code>widg</code> with <code>w</code> as a <code>parent</code>, <code>widg</code> appears inside of the <code>w</code> (in left top corner).</p>
  
  <p>What is the easiest and most clear way to fix that?</p>
  
  <p>Thanks!</p>