C++ (Qt) QTextBlock block = ui->textEdit->document()->lastBlock(); qDebug()<<block.text();
C++ (Qt)QTextEdit *textEdit;QStringList lines = textEdit->toPlainText().split('\n');QString lastLine;if (!lines.isEmpty()) lastLine = lines.last();