As far as I know, there is no direct method to get the current line number. You might have to count it by yourself by iterating through the text blocks and comparing them to text cursors text block. Please someone correct me if I'm wrong! I hope I am, this isn't very convenient..
Qt Code:
int line = 0; { ++line; if (block == cursor) break; } qDebug() << "line" << line;To copy to clipboard, switch view to plain text mode
This might become a little costly if it's calculated all the time when cursor moves...
It might be worth taking a quick look at this article:
Lazy updating for ascertaining block numbers in a document
Bookmarks