Hello everybody,

I'm trying to move the cursor of a QTextEdit to a position that is specified with line number and column. I've tried with movePosition() in the QTextCursor like this:

Qt Code:
  1. QTextEdit * editor;
  2. //Moves the cursor to the beginning of the document
  3. editor->textCursor().setPosition(0,QTextCursor::MoveAnchor);
  4. //Now moves the cursor to the line "line" and in the column "index"
  5. editor->textCursor().movePosition(QTextCursor::Down, QTextCursor::MoveAnchor,line-1);
  6. editor->textCursor().movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor, index);
To copy to clipboard, switch view to plain text mode 

However, the only thing I get with this is the cursor in the same position as the beginning.
Does anybody know how to achieve this??

Thank you in advance!

Alberto