title: Qt 5.1 QApplication Without Display - QXcbConnection: Could not connect to display
body: <p>I'm using Qt5.1 and I'm trying to create a QApplication without a display. I need to draw text with QPainter, so I need to use QApplication (or QGuiApplication), otherwise I get a segfault.</p>
  
  <p>The application worked fine in Qt4.8, but fails in Qt5.1 on a headless version of Ubuntu with the error:</p>
  
  <blockquote>
    <p>"QXcbConnection: Could not connect to display".</p>
  </blockquote>
  
  <p>In Qt 4.8, I was able to use the following constructor with GUIenabled = false to create a QApplication that did not require a display:</p>
  
  <blockquote>
    <p>QApplication::QApplication ( int &amp; argc, char ** argv, bool GUIenabled )</p>
  </blockquote>
  
  <p>In Qt5.1, the constructor for QApplication no longer has the GUIenabled flag.</p>
  
  <p>I scanned the source code briefly, and there does seem to be a flag in the QApplication constructor, but it is undocumented as to what options can be used in that flag. Using "false" does not work.</p>
  
  <p>How can I create a QApplication without a display? Is there an alternative method to telling QApplication GUIenabled = false? Alternatively, can I create a QCoreApplication that will not segfault when drawing text with QPainter on a QImage?</p>