How to get the coordinates(rows and columns) of the text cursor of QTextEdit?
-
I'm developing a simple notepad application with QT (windows 10, 64bit, mingw) and I want to display the coordinates of the text cursor in the status bar as shown below(in windows notepad).
I'm a compete beginner in QT so sorry if you find out this question is stupid.
-
@Induwara-super But what is exactly your question?
How to get coordinates?
How to display them? -
The row and the column the cursor is currently in (ex: row-12, column -1) .
I'm planning to use a label to display the, for example the ex thing somewhere in the window. -
@Induwara-super https://doc.qt.io/qt-5/qtextedit.html#textCursor
https://doc.qt.io/qt-5/qtextcursor.html#columnNumber
Line number is more difficult - you will need to work with blocks: https://doc.qt.io/qt-5/qtextblock.html