I wrote a very simple test code,which receive a utf8 string from QLineEdit and display it in messagebox:
QString txtString
= ui
->lineEdit
->text
();
QString scndString
= txtString.
toUtf8();
msgBox.setText(scndString);
msgBox.exec();
QString txtString = ui->lineEdit->text();
QString scndString = txtString.toUtf8();
QMessageBox msgBox;
msgBox.setText(scndString);
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 :
QString txtString
= ui
->lineEdit
->text
();
QString scndString
= txtString.
toLatin1.
toutf8.
toHex();
msgBox.setText(scndString);
msgBox.exec();
QString txtString = ui->lineEdit->text();
QString scndString = txtString.toLatin1.toutf8.toHex();
QMessageBox msgBox;
msgBox.setText(scndString);
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();
Bookmarks