You are not logged in.

Dear visitor, welcome to If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.


Saturday, November 12th 2016, 2:58pm

How to get the actual line and column number of a QPlainTextEdit and print it in a label in the same MainWindow

hi guys, i new here and a beginer in this, i need your help please.

i am trying to print the actual cursor line number in a label and the column in another, but in real time, so, when i type a letter this values update automaticaly, but i dont know how to do it, this iw what ia have.

if you are wonder my logic is like a netbeans IDE Editor with QTabWidget, when i click a button, i create a new QPlainTextEdit and then i add it to the ui->tabWidget;

Source code

void MainWindow::on_pushButton_clicked()
	std::string nuevo = "New" +std::to_string(i++)+".f2p";

	QPlainTextEdit *newt = new QPlainTextEdit(ui->tabWidget);

but how can i tell that when 'newt.cursorPositionChange()' print in label_3 "LineNo. :" + the line numbre, the same question to the column number, please help

Similar threads

Used tags

c++, label, QTPlaintextEdit