Currently, if you set the flags to QTextDocument::FindWholeWords

The system ONLY checks for a boundary of isNumberOrLetter, which is NOT the 
same as a whole word.

For instance, if you are searching for the whole word "state" and the text is 
"current_state" is should NOT match, however it does, since _ is not a Number 
or a Letter.

The offending code is in a static findInBlock, so there is no way to override 
it..
          if ((start != 0 && text.at(start - 1).isLetterOrNumber())
                || (end != text.length() && text.at(end).isLetterOrNumber())) {

My solution was to convert the text into a QRegEx bounded by "\b" on either side

One problem I see, is QChar does not have a "isWordSeparator", that would line 
allow for an easy replacement of isLetterOrNumber with !isWordSeparator.

My recommendation, would be to add isWordSeparator to QChar, as well as 
changing the code...


Ideas/thoughts?

Scott





_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to