【发布时间】:2014-11-03 17:03:17
【问题描述】:
我尝试在 Qt 中显示一个波斯语字符串:
QMessageBox msg;
QString str = "یا حسین";
msg.setText(QString::fromUtf8(str));
msg.exec();
但它显示以下错误:
/home/msi/Desktop/VoMail 项目/项目/VoMail-build-desktop-Qt_4_8_1_in_PATH__System__Release/../VoMail/mainwindow.cpp:40: 错误:没有匹配函数调用 'QString::fromUtf8(QString&)'
我想使用字符串变量,而不是直接使用字符串。
如何将 QString 变量转换为 Utf8?
【问题讨论】: