Hi all,

Suppose that you have the following code fragment:
Qt Code:
  1. QTextEdit textEdit;
  2.  
  3. textEdit.setHtml("<h2>Description</h2>\n<p>More Details Here</p>");
  4. textEdit.show();
  5. std::cout << "textEdit.toHtml() = " << textEdit.toHtml().toStdString() << std::endl << std::endl;
To copy to clipboard, switch view to plain text mode 

The output is displayed as expected. But the HTML format is as follows (from std::cout):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
<p style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:x-large; font-weight:600;">Description</span></p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">More Details here.</p></body></html>
My question is: Is there anyway for keeping the original HTML tags? When I tried to remove the first line (<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">) using designer or by code, I still get the HTML format that qt forces to be. I know that the displayed rendered text is correct. But my concern is to keep original HTML text untouched (for another application that takes that text from Qt application and the former crashes due to different standard text coming from Qt).

Many thanks in advance.