title: QTextDocument default style sheet
body: <p>I try to draw a text on a QImage using  the QTextDocument.
  How to set a default ("body") style?</p>
  
  <p>Currently I use a <code>&lt;p&gt;</code> tag, like this</p>
  
  <pre><code>QPainter painter(_image);
  QTextDocument doc;
  doc.setDefaultStyleSheet("p { color : green; background-color : black; }");
  doc.setHtml("&lt;p&gt;test 123&lt;/p&gt;");
  doc.drawContents(&amp;painter,_image-&gt;rect());
  </code></pre>
  
  <p>I would like to get rid of <code>&lt;p&gt;</code> tag</p>
  
  <pre><code>doc.setHtml("test 123");
  </code></pre>
  
  <p>I have tried</p>
  
  <pre><code>doc.setDefaultStyleSheet("body { color : green; background-color : black; }");
  doc.setDefaultStyleSheet("{ color : green; background-color : black; }");
  doc.setDefaultStyleSheet("color : green; background-color : black; ");
  doc.setDefaultStyleSheet("QImage { color : green; background-color : black; }");
  </code></pre>
  
  <p><em>EDIT:</em></p>
  
  <p>I have also tried</p>
  
  <pre><code>doc.setDefaultStyleSheet("* { color : green; background-color : black; }");
  </code></pre>