title: can't cast QMainWindow from QMdiSubWindow
body: <p>So i have a program that uses a subclass of QMainWindow for QMdiArea widgets. I'm only doing this because QDockWidgets can only be used in a QMainWindow (and my subclass needed dock widgets).</p>
  
  <p>I was testing my class's serialization for saving purposes and my pointer wasn't correct. Here is the code</p>
  
  <pre><code>    if (ui-&gt;mdiMain-&gt;subWindowList().length() &gt; 0)
      {
          QString path = QFileDialog::getSaveFileName(this, "Save Build Order", "" ,"*.cbo");
  
          if (path &gt; 0)
          {
              QFile file(path, this);
              if (file.open(QFile::WriteOnly) == true)
              {
                  QWidget* widget = reinterpret_cast&lt;QWidget*&gt;(ui-&gt;mdiMain-&gt;activeSubWindow());
                  WidgetBuildOrder* widgetBuildOrder = reinterpret_cast&lt;WidgetBuildOrder*&gt;(widget);
  
                  QDataStream stream(&amp;file);
                  stream &lt;&lt; widgetBuildOrder;
  
                  file.close();
                  ui-&gt;statusBar-&gt;showMessage("Save Successful.", 5000);
              }
          }
  
      }
  }
  </code></pre>
  
  <p>WidgetBuildOrder is a subclass of MainWindow.</p>
  
  <p>so my thought was that I could keep casting the pointer to what it actually is. When I created the MDI area, i passed a new WidgetBuildOrder. Is there a way to do this?</p>
  
  <p>To Clarify, after the casting I do get a pointer its just pointing to garbage. Not the values set in the WidgetBuildOrder I actually have open.</p>
  
  <p>Any help will be appreciated,</p>
  
  <p>Thanks,</p>
  
  <p>Jec</p>