count chars in line QTextEdit
Unsolved
General and Desktop
-
Hi, everyone.
Let's considering a qTextEditBlock.
By using the QTextCursor, is there any way to count the number of chars present in a line?
I move on the line where I want to count the chars in the following way:QTextCursor curs=ui->textEdit->textCursor(); curs.movePosition(QTextCursor::Start); curs.movePosition(QTextCursor::NextBlock,QTextCursor::MoveAnchor, line)
where line is an integer that indicates the block in which I want to move.
Now, how can I do?
Thanks to everyone -
curs.block().length()
-
but what if the number of chars is lower than the block length? For example if I push the enter button on the keyboard..
-
@Martinuccia_96
then its a new block