Searching for strings within a QTextBrowser?
-
Are there any built in functions for this? My end goal is to highlight words within the open page of a help document (which is a QTextBrowser) that the user searches for. I know about the QString find() function, but I'm wondering if there's something similar for QTextBrowser. Thanks in advance
-
QTextBrowser inherits "QTextEdit::find()":http://doc.trolltech.com/4.7/qtextedit.html#find
-
Per the docs, when it finds a match, it sets the cursor to select the location. You could make a copy of the cursor location with QTextEdit::textCursor() every time a location is found.
Disclaimer, it's been a while since I had to use any of this code, so your mileage may vary.
-
Hi,
This [http://doc.qt.nokia.com/4.7-snapshot/uitools-textfinder.html] example might help you. I was doing the same stuff sometime back. -
Hi,
also you can use regular expression method :
link: http://developer.qt.nokia.com/doc/qt-4.7/qml-regexpvalidator.htmlbq. Detailed Description
This element provides a validator, which counts as valid any string which matches a specified regular expression.