Qt Code:
  1. QString styleSheetString = "#QTextEdit { border: 1px solid black; }";
  2. ui->text_edit_object->setStyleSheet(styleSheetString);
To copy to clipboard, switch view to plain text mode 

Just try this to set border.