Scrolling QTextEdit box to show found text
I've been using Qt on ubunto for some time and have written several programs. So far I have solved problems with Google but have now hit a brick wall with what must be a simple problem.
I have a QPlainTextEdit box (read-only) containing a few hundred lines of text and have extracted the QTextDocument from it. I used the QTextDocument find() function to get a QTextCursor for the position of a particular word and have highligted it. So far so good. I now want to scroll the QPlainTextEdit box to show the word that was found.
It must be simple but I have been unable to work out how to do it! Help will be much appreciated.
After setting the cursor in the right place you can use "ensureCursorVisible()":http://qt-project.org/doc/qt-4.8/qplaintextedit.html#ensureCursorVisible.
Thanks - simple when you know how!