QTextCursor cursor(document); //create cursor for QTextDocument cursor.insertText("Hello World!"); //insert text at cursor position
QTextCursor cursor(document); //create cursor for QTextDocument cursor.select(QTextCursor::Document); //select entire document
QTextEdit *textEdit = new QTextEdit(); //create QTextEdit widget QTextCursor cursor = textEdit->textCursor(); //get cursor for widgetThis code creates a QTextEdit widget and retrieves the QTextCursor used by the widget to manipulate text. Package library: Qt library.