title: Access to parent in Qt
body: <p>I try to access parent from a child.
  Parent and Child class inherits <code>QWidget</code>
  Let see:</p>
  
  <pre><code>//parent.h
  
  public:
  child* h_child = nullptr; //pointer to child - now i can control child in parent methods
  
  
  //method in parent.cpp
  h_child = new child(); //show child window
  h_child-&gt;show(); //show next window
  </code></pre>
  
  <p>And child</p>
  
  <pre><code>//child.cpp in child method
   parent_class *sth = qobject_cast&lt;parent_class*&gt;(parentWidget());
  
  if (sth == NULL){
      QMessageBox::warning(this, "error !", "error!");
  }
  </code></pre>
  
  <p>And ofc i saw 'error'</p>
  
  <ol>
  <li>I try to replace <code>parentWidget()</code> with <code>this-&gt;parent()</code>. // result the same</li>
  <li><p>I try to run child instance like that:</p>
  
  <p><code>h_child = new child(this); //show child window</code></p></li>
  </ol>
  
  <p>But when i try to use <code>h_child-&gt;show()</code> the window which is showed is 'broken' (i have window in window(child window in parent window , without child window frame) - it looks illegibly)</p>
  
  <p>So how can i access to parent methods and variables ?</p>