The following code should do the trick:
```
int currentLine = ui->plainTextEdit->textCursor().blockNumber()+1;
```