title: the first call of QPainter::drawText() takes very long causing flicker
body: <p>I have a problem with flickering at application startup. I reduced this problem to this very simple code snippet.</p>
  
  <pre><code>#include &lt;QApplication&gt;
  #include &lt;QDebug&gt;
  #include &lt;QElapsedTimer&gt;
  #include &lt;QPainter&gt;
  #include &lt;QWidget&gt;
  
  class Widget : public QWidget {
  protected:
      void paintEvent(QPaintEvent*) {
          QPainter p(this);
          QElapsedTimer t;
          t.start();
          p.drawText(20, 20, "XYZ");
          qDebug() &lt;&lt; "drawing text takes" &lt;&lt; t.elapsed() &lt;&lt; "ms";
      }
  };
  
  int main(int argc, char *argv[]) {
      QElapsedTimer t;
      t.start();
      QApplication a(argc, argv);
      Widget widget;
      widget.show();
      a.processEvents();
      qDebug() &lt;&lt; "starting application takes" &lt;&lt; t.elapsed() &lt;&lt; "ms";
      return a.exec();
  }
  </code></pre>
  
  <p>It shows a white window for almost a second and then it draws a text. The log says "drawing text takes 950 ms" when it is drawn for the first time. This is in release mode. Subsequent draws are almost immediate, something like 0 ms. Is there anything I can do to make this faster so that the window does not flicker? </p>
  
  <p>I assume the first call prepares some data (probably font related) which are then cached for the subsequent calls. Can I do something to prepare these data and cache these even before the first draw?</p>
  
  <p>For example, if I wrote this: <code>QLabel lbl("XYZ"); lbl.show();</code> instead of my own widget, it will not flicker. Any ideas how they avoided flickering in <code>QLabel</code>?</p>
  
  <p>I am on Windows 10 with Qt 5.11.1.</p>