title: Qt5 QuickView cannot create window: no screens are available
body: <p>I receive this error (title, below) whenever I try to run the following code:</p>
  
  <pre><code>#include &lt;QCoreApplication&gt;
  #include &lt;QQuickView&gt;
  
  int main(int argc, char *argv[]){
      QCoreApplication app(argc, argv);
  
      QQuickView view;
      view.setSource(QUrl::fromLocalFile("app.qml"));
      QObject *object = (QObject*)view.rootObject();
  
      view.show();
  
      delete object;
      return app.exec();
  }
  </code></pre>
  
  <blockquote>
    <p>Cannot create window: no screens available</p>
    
    <p>The program has unexpectedly finished.</p>
  </blockquote>
  
  <p>All I can find online for that error are bug reports arising from specific conditions significantly more involved than the above.</p>
  
  <p><code>app.qml</code> is a file that runs fine alone, i.e. without the above C++ and in a separate project configured as a 'Qt Quick UI'. Giving it's <code>qrc://</code> path, or deliberately specifying a file which does not exist has no effect.</p>
  
  <p>Note the <code>QObject*</code> cast - this was not present in <a href="http://qt-project.org/doc/qt-5/qtqml-cppintegration-interactqmlfromcpp.html" rel="nofollow">the docs</a>, but without it:</p>
  
  <blockquote>
    <p>/main.cpp:11: error: cannot initialize a variable of type 'QObject *' with an rvalue of type 'QQuickItem *'</p>
  </blockquote>
  
  <p>How should this be done?</p>