I am trying to get the cursor position in a QPlainTextEdit. So I get the the cursor object and the call columnNumber().
The problem appears where I have tab characters on that line.
At the end of the line for a text like this
AB
columnNumber() returns 2
If I have a tab 4 characters long
[TAB4]AB
columnNumber() returns 3, but I need the "real" column number -> 6
Is there a function that returns that value?


Reply With Quote

You can react on tab key and substitute the tabulator character with an appropriate number of spaces. Then the value will be returned as you want it. If that's not an option then you can always calculate the position yourself.

Bookmarks