I wrote a very simple test code,which receive a utf8 string from QLineEdit and display it in messagebox:

Qt Code:
  1. QString txtString = ui->lineEdit->text();
  2. QString scndString = txtString.toUtf8();
  3. QMessageBox msgBox;
  4.  
  5. msgBox.setText(scndString);
  6. msgBox.exec();
To copy to clipboard, switch view to plain text mode 

Know I want to display utf8 hex value of string instead of string itself, but when I try to do this :

Qt Code:
  1. QString txtString = ui->lineEdit->text();
  2. QString scndString = txtString.toLatin1.toutf8.toHex();
  3. QMessageBox msgBox;
  4.  
  5. msgBox.setText(scndString);
  6. msgBox.exec();
To copy to clipboard, switch view to plain text mode 

I received this message:
error: 'txtString.QString::toLatin1' does not have class type QString scndString = txtString.toLatin1.toutf8.toHex();