I am using QTextEdit for this. Method insertHtml() helped. But this method works not as I imagine.

My file1.html is
Qt Code:
  1. <html>
  2. <body>
  3. <p>
  4. <h2>title1</h2>
  5.  
  6. <ul>
  7. <li>bla</li>
  8. <li>bla</li>
  9. </ul>
  10. </p>
  11. <br>
  12. </body>
  13. </html>
To copy to clipboard, switch view to plain text mode 

File2.html is
Qt Code:
  1. <html>
  2. <body>
  3. <p>
  4. <h2>title2</h2>
  5.  
  6. <ul>
  7. <li>blabla</li>
  8. <li>blabla</li>
  9. </ul>
  10. </p>
  11. <br>
  12. </body>
  13. </html>
To copy to clipboard, switch view to plain text mode 

My code is:
Qt Code:
  1. QString fileName1(":/file1.html");
  2. QFile file1(fileName1);
  3. if (file1.open(QIODevice::ReadOnly))
  4. {
  5. QString data1(file1.readAll());
  6. if (fileName1.endsWith(".html"))
  7. textEdit->insertHtml(data1);
  8. }
  9.  
  10. QString fileName2(":/file2.html");
  11. QFile file2(fileName2);
  12. if (file2.open(QIODevice::ReadOnly))
  13. {
  14. QString data2(file2.readAll());
  15. if (fileName2.endsWith(".html"))
  16. textEdit->insertHtml(data2);
  17. }
To copy to clipboard, switch view to plain text mode 

The problem is, the title of the file2 is always followed by the last bla, not aligned to the left of the file. If I insert a break line between these two parts:
Qt Code:
  1. textEdit->insertHtml("<hr>");
To copy to clipboard, switch view to plain text mode 
The line is beneath the file2's title. crazy!

Anyone can help? Or is there another way to complish this function?
Thanks.