use this function:

Qt Code:
  1. void WriteLog(QString s, QColor c)
  2. {
  3. if(s.isEmpty())
  4. return;
  5.  
  6. QTextStream theStream(s,IO_ReadOnly);
  7. QString sColor = "<font color="+c.name()+">";
  8. while ( !theStream.atEnd() )
  9. read_textEdit->append(QTime::currentTime().toString() + " " + sColor+theStream.readLine());
  10. //edLog->setParagraphBackgroundColor(edLog->paragraphs()-1,c);
  11. QFile file( "[LOG FILE NAME].log" ); // Write the text to a file
  12. if ( file.open( IO_WriteOnly ) )
  13. {
  14. QTextStream stream( &file );
  15. for(int i=0;i<m_log->paragraphs();i++)
  16. stream << read_textEdit->text(i) << "\r\n";
  17. }
  18. file.close();
  19. }
To copy to clipboard, switch view to plain text mode 
this function write the string s to the read_textEdit member and a log file(you do not need to use this "file code" if you do not want log file)
each time you want to write to a log file or to the read_textEdit member call this function with any color you want