PDA

View Full Version : How does QTextEdit store the text?



Fox196
15th August 2011, 02:37
Hi,

I want to implement a fuzzy search in a QTextEdit, so I want to know how does it store the text, basically what I need is the list of words and the position of each word (to move the cursor there), is there a way to get that, or should I just get the plain text and do it myself?

Thanks

marcvanriet
15th August 2011, 23:46
You could use QTextCursor to go over the entire document word by word, keep a list of the words, and use position() to remember its position. Depends on what you want exactly. QTextEdit has a find() function too.

Regards,
Marc

Fox196
18th August 2011, 04:47
Thanks for answering,

I did what you say, and it worked just as I wanted.

I've seen in the source code that the text is separated in blocks, I'll take a look later.

Cheers.