[Interest] Highlighting selected text in QTextDocument::drawContents()

igor.mironchik at gmail.com igor.mironchik at gmail.com
Tue Apr 1 12:11:45 CEST 2014

Don't know will it work with QTextDocument::drawContents() or not.

I did it like it done in QTextEdit:

QAbstractTextDocumentLayout::PaintContext ctx = getPaintContext( q );
p.setClipRect( r, Qt::IntersectClip );
ctx.clip = r;

doc->documentLayout()->draw( &p, ctx );

-----Original Message----- 
From: Diego Iastrubni
Sent: Tuesday, April 01, 2014 10:41 AM
To: igor.mironchik at gmail.com
Cc: interest at qt-project.org
Subject: Re: [Interest] Highlighting selected text in 

Depends on the use case, but what about
QTextDocument::setExtraSelections() with the correct QTextCursor?


On Sat, Mar 29, 2014 at 10:27 PM,  <igor.mironchik at gmail.com> wrote:
> Hi.
> How to highlight selected text in QTextDocument::drawContents() ?
> Thanks.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

More information about the Interest mailing list