[Qt-interest] Emulating selection with offsets

John McClurkin jwm at nei.nih.gov
Tue Apr 21 16:08:51 CEST 2009


sathya tej wrote:
> 
> Please help me out guys, I am in deep trouble.
> 
> Thank You.
> 
> Sathya.
Have you looked at the textedit demo or the richtext example in the Qt 
distribution?

> 
> 
> On Tue, Apr 21, 2009 at 7:17 AM, sathya tej <ragesathya at gmail.com 
> <mailto:ragesathya at gmail.com>> wrote:
> 
> 
>     Hello all,
> 
>     I have a text file. I only have startOffset and endOffset of a
>     section of text in that file.
> 
>     I need to highlight that section.
> 
>     I used the below approach but failed.
> 
>     Please guide me.
> 
> 
> 
>     QTextCursor *cur = new QTextCursor();
> 
>      textEditorArray[textEditorCount]->setTextCursor(*cur);
> 
>     cursor->setPosition (startOffset , QTextCursor::MoveAnchor );
> 
>     cursor->movePosition ( QTextCursor::NextCharacter,
>     QTextCursor::KeepAnchor, endOffset - startOffset);
> 
>     textEditorArray[textEditorCount]->setFontUnderline(true);
> 
> 
> 
> 
> 
>     -- 
>     whatever happens happens for GOOD
> 
> 
> 
> 
> -- 
> whatever happens happens for GOOD



More information about the Qt-interest-old mailing list