PDA

View Full Version : How can I get a textCursor to move to a particular line?



aarelovich
22nd June 2010, 19:29
Hello:

Here is what I want to do: I have some text that needs to be checked. While I'm checking it (using a QTextStream::readLine()) I also count the lines. If I find a mistake then I show the line where it was found. Then I list them and I would like to write a routine that somehow hiighlights the line with the mistake when the user clicks on the item in the list.

However I cannot figure out any way to do this other than to move or select the cursor in the document to the position corresponding to the line. How can I figure what is the cursor position that corresponds to the line? I can, for instance, get the TextBlock that corresponds to a given line. And I can modify the format of that text block... but only if it contains the mouse cursor. And again I don't have anyway to set the cursor position to a given TextBlock.....

Can anyone help me?

Thank you very much!!