title: Must construct a QApplication before a QWidget
body: <p>Everywhere only just "before QPaintDevice" questions and nowhere is my error. So, here we go.</p>
  
  <p>I need an extern QWidget to be able to get access to it from outside (because I don't know any other ways to do it). Basically, I need this: Create 2 QWidgets from 1 window, go to first window and from there hide main window and show second window created by main window (although main window is not main(), it is QWidget too).</p>
  
  <p>I added</p>
  
  <pre><code>extern QWidget *widget = new QWidget
  </code></pre>
  
  <p>everywhere and everyhow in possible ways, and I still got this message. I suppose, it means that I need to create my QApplication (in main.cpp) and only then declare any QWidgets. But then HOW can I access those QWidgets from another QWidgets?</p>
  
  <p>Code is here:
  <a href="https://github.com/ewancoder/game/tree/QWidget_before_QApp_problem" rel="nofollow">https://github.com/ewancoder/game/tree/QWidget_before_QApp_problem</a></p>
  
  <p>P.S. The final goal is to be able show and hide both gamewindow.cpp and world.cpp from battle.cpp (just regular class)</p>
  
  <p>And btw, adding Q_OBJECT and #include  both don't work.</p>
  
  <p>Anyway, if I cannot use functions from one window to another, than what's the point? I can have one window in another, and then another in that one, and then one in that another... but I can't do anything from the last to the previous. After years on Delphi that seems strange to me.</p>