[Qt-interest] Owner draw QTextEdit?

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Wed Feb 4 05:47:00 CET 2009


Hi Bob, 

I would say quite difficult, but doable by hacking the sources!  You would
need to paint the substitute characters, without affecting the layout
handling.  Have a look at QTextFragment. 

Tony.

> Was this one too hard, or too easy?
> 
> 
> Bob Hood wrote:
> > I'm using v4.4.3, and I'm interested in enhancing the way 
> text is being
> > displayed in a multi-line QTextEdit.  Specifically, I want 
> to be able to
> > draw character representations for things that are not 
> printable, like
> > tabs, spaces and carriage returns.  Looking through the 
> class (and its
> > inheritance), I'm not seeing a straight-forward way of accomplishing
> > this via some kind of "owner draw" mechanism.  I also didn't see
> > anything (or perhaps I missed it) in the examples.
> >
> > Can somebody point me in the right direction on this?  
> Perhaps a link to
> > some code example that does custom drawing of text?




More information about the Qt-interest-old mailing list