Qt Code:
  1. void writeToEditor( QString partOfText, double readBytes )
  2. {
  3. QString newFormat;
  4. for( int i = 0; i < readBytes; i = i + 10 )
  5. {
  6. QStringRef subString( &partOfText, i, 10 );
  7. newFormat.append( subString );
  8. newFormat.append( " " );
  9. }
  10.  
  11. objQPlainTextEdit.appendPlainText( newFormat );
  12.  
  13. }
To copy to clipboard, switch view to plain text mode 

Here objQPlainTextEdit is an object of QPlainTextEdit.

Considering: https://doc.qt.io/qt-5/qplaintextedit.html

Each character within a paragraph has its own attributes, for example, font and color.
I can see there is QPalette. How to use it to color the alphabets displayed in QPlainTextEdit, differently?

For example: 'A' should be of red color, and 'B' should be of green colour.