I have created simple notepad from Qt/C++. I want to print the line number on status bar of QMainWindow when I click somewhere on the text area, like notepad of Microsoft Windows

I have created simple notepad from Qt/C++. I want to print the line number on status bar of QMainWindow when I click somewhere on the text area, like notepad of Microsoft Windows

You can connect the
cursorPositionChanged()signal of your text area to a custom slot of yourQMainWindow: