QTextCursor cursor = textDocument->find("needle"); QChar character = cursor.document()->characterAt(cursor.position());
QTextCursor cursor(textDocument); for (int i = 0; i < textDocument->characterCount(); ++i) { QChar character = cursor.document()->characterAt(i); // Do something with the character cursor.movePosition(QTextCursor::NextCharacter); }This example uses a QTextCursor to iterate over all characters in the document and do something with each character. The characterAt() function is used to get the character at each position. Package library: Qt Gui (qt5gui.dll)