For, Get values from the user:
Qt Code:
  1. int x = ui->textEdit->toPlainText().toInt(&ok,10);
  2. //Or
  3. QString x = ui.textEdit->toPlainText();
To copy to clipboard, switch view to plain text mode 

and for, Put the values in the box:
Qt Code:
  1. ui->textEdit->setPlainText( QString::number( 123 ));
To copy to clipboard, switch view to plain text mode