<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>I'm trying to render rotated rich text, and it just keeps
      clipping on me.  I can't seem to find the magic combination that
      will expand the clipping region.<br>
      <br>
      The simplest paintEvent():<br>
    </tt>
    <blockquote><tt>void VerticalLabel::paintEvent(QPaintEvent*)</tt><br>
      <tt>{</tt><br>
      <tt>    QPainter painter(this);</tt><br>
      <br>
      <tt>    painter.rotate(-20);</tt><br>
      <br>
      <tt>    QTextDocument td;</tt><br>
      <tt>    td.setHtml(text());</tt><br>
      <tt>    td.drawContents(&painter);</tt><br>
      <tt>}</tt><br>
    </blockquote>
    <tt>Slightly more involved paintEvent():<br>
    </tt>
    <blockquote><tt>void VerticalLabel::paintEvent(QPaintEvent*)</tt><br>
      <tt>{</tt><br>
      <tt>    QPainter painter(this);</tt><br>
      <br>
      <tt>    painter.rotate(-20);</tt><br>
      <br>
      <tt>    QTextDocument td;</tt><br>
      <tt>    td.setHtml(text());</tt><br>
      <tt>    QAbstractTextDocumentLayout::PaintContext ctx;</tt><br>
      <tt>    ctx.clip = QRectF(0, 0, 100, 400);</tt><br>
      <tt>    td.documentLayout()->draw(&painter, ctx);</tt><br>
      <tt>}</tt><br>
    </blockquote>
    <tt>In both cases, I'm going from this without the rotation:<br>
      <br>
      <img moz-do-not-send="false"
        src="cid:part1.C6EA864C.D4360CE4@comcast.net" alt="" width="663"
        height="77"><br>
      <br>
      to this with it:<br>
      <br>
      <img moz-do-not-send="false"
        src="cid:part2.BC770D47.2442B582@comcast.net" alt="" width="623"
        height="78"><br>
      <br>
      <br>
      Question:  How do I alter this clipping so the text is visible
      when it is vertical?  Setting the PaintContext.clip doesn't appear
      to have any impact no matter what values I put in it, and Google
      doesn't have any answers, as far as I could find.<br>
      <br>
    </tt>
  </body>
</html>