[Interest] I know I'm just being stupid here...

Bob Hood bhood2 at comcast.net
Thu Jan 24 17:44:04 CET 2019


Thanks for the response, Tony.

I added an explicit setting of the page size:

    ...
    QTextDocument td;
    QSizeF size(2000, 2000);
    td.setPageSize(size);
    td.drawContents(&painter);
    ...

Unfortunately, I still get the same clipping region as before.


On 1/23/2019 8:49 PM, Tony Rietwyk wrote:
>
> 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
>
> _______________________________________________
> 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/dc5f3ec7/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/dc5f3ec7/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/dc5f3ec7/attachment-0001.png>


More information about the Interest mailing list