<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi Bob, <br>
    </p>
    <p>I think you'll need to increase the size of the document - maybe
      the paintContext is being clipped to the document size? <br>
    </p>
    <p>Hope that helps, <br>
    </p>
    <p>Tony</p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 24/01/2019 2:18 pm, Bob Hood wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:9f10c5f4-fe44-5fe1-0ceb-ff0f3d03f9c9@comcast.net">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <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.734E4DFE.AE83D2C8@rightsoft.com.au" alt=""
          class="" width="663" height="77"><br>
        <br>
        to this with it:<br>
        <br>
        <img moz-do-not-send="false"
          src="cid:part2.98E3ECE1.9B7E8FBB@rightsoft.com.au" alt=""
          class="" 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> <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Interest mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Interest@qt-project.org">Interest@qt-project.org</a>
<a class="moz-txt-link-freetext" href="https://lists.qt-project.org/listinfo/interest">https://lists.qt-project.org/listinfo/interest</a>
</pre>
    </blockquote>
  </body>
</html>