C++ (Qt)veiw->setTextCursor(cursor)veiw->centerCursor()
veiw->verticalScrollBar()->setValue(veiw->verticalScrollBar()->value() + veiw->cursorRect().y());
QTextCursor cursor = veiw->textCursor();QTextBlock cursorBlock = cursor.block();QTextLine cursorLine = cursorBlock.layout()->lineForTextPosition(cursor.positionInBlock());int row = cursorBlock.firstLineNumber() + cursorLine.lineNumber();veiw->verticalScrollBar()->setValue(row);
C++ (Qt)void QPlainTextEdit::centerCursor () [slot]