[Interest] I know I'm just being stupid here...
Tony Rietwyk
tony at rightsoft.com.au
Thu Jan 24 04:49:55 CET 2019
Hi Bob,
I think you'll need to increase the size of the document - maybe the
paintContext is being clipped to the document size?
Hope that helps,
Tony
On 24/01/2019 2:18 pm, Bob Hood wrote:
> 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.
>
> The simplest paintEvent():
>
> void VerticalLabel::paintEvent(QPaintEvent*)
> {
> QPainter painter(this);
>
> painter.rotate(-20);
>
> QTextDocument td;
> td.setHtml(text());
> td.drawContents(&painter);
> }
>
> Slightly more involved paintEvent():
>
> void VerticalLabel::paintEvent(QPaintEvent*)
> {
> QPainter painter(this);
>
> painter.rotate(-20);
>
> QTextDocument td;
> td.setHtml(text());
> QAbstractTextDocumentLayout::PaintContext ctx;
> ctx.clip = QRectF(0, 0, 100, 400);
> td.documentLayout()->draw(&painter, ctx);
> }
>
> In both cases, I'm going from this without the rotation:
>
>
>
> to this with it:
>
>
>
>
> 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.
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190124/d1502872/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2019-01-23_20-13-25.png
Type: image/png
Size: 55992 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190124/d1502872/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2019-01-23_20-14-28.png
Type: image/png
Size: 57496 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190124/d1502872/attachment-0001.png>
More information about the Interest
mailing list