How to get CharFormat from each char
-
hi, i need get CharFormat () from each char in QTextEdit, but i dont know how.
If i will know method who selectChar(int Char), then will by lock some like that:
[code]
for(int i=0; i<ui->TextEdit->toPlaintext.lenght(); i++)
{
selectChar(i);
currentCharFormat ()// and here return charFormat()
}
[/code] -
CharFormat ? What does it mean ?
-
This might get you what you are looking for.
@QTextCursor cur(TextEdit->document());
QTextCharFormat charformat;for (int i = 1; i <= TextEdit->length(); i++)
{
cur.setPosition(i);
charformat = cur.charFormat();
}
@The setPosition method doesn't state what index it starts from but I think index 0 would be before the first character in your document and index = length() would be right after the last character.