19

I am trying to get the text from a text edit and store it in a QString .

When I write this

QString text = ui->textEdit->toPlainText();

it only reads the text before the first '\n' So how can I get the whole text with '\n's in it.

This is being called from a slot like this: -

void MainWindow::on_pushButton_clicked() 
{ 
    QString text = ui->textEdit->toPlainText(); 
    ui->label_2->setText(text); 
}
Anurag Singh
  • 492
  • 6
  • 16
samvel1024
  • 1,123
  • 4
  • 15
  • 39

1 Answers1

11

Turning my comment into an answer

Make sure that the label is high enough to actually display multi-line text.

Angew is no longer proud of SO
  • 167,307
  • 17
  • 350
  • 455