PDA

View Full Version : QTextEdit->find()



derrickbj
11th June 2008, 13:59
I'm having a bit of a mind block for something that could be so obvious. I have a TextBrowser that's read only and I want to find specific text in a line, but the text may not be in consecutive words. For instance, I want the TextBrowser to scroll to the line saying "The quick brown fox jumped over the lazy dog" when somebody searches for "the quick brown over dog." I can't exactly feed the criteria to QTextEdit::Find() since it does an exact string match.

Any ideas?

jacek
12th June 2008, 01:24
You could try to use QTextDocument::find() (the one with QRegExp parameter), but first you have to exactly define the search criteria.

What exactly "may not be in consecutive words" means? Is there a maximum number of non-matching words you can skip? Or maybe you want to look for "the quick brown over" if there are no matches for "the quick brown over dog"?