QApplication app(argc, argv); QTextEdit textEdit("Hello World!"); textEdit.show(); QString text = textEdit.toPlainText(); // read text content