C++ 在QT应用程序中显示为问号的阿拉伯文文本
我使用的是Qt5.2.0,我试图将QPushButton的文本设置为一些阿拉伯语文本,但当我运行程序时,文本显示为问号。我甚至试过:C++ 在QT应用程序中显示为问号的阿拉伯文文本,c++,qt,C++,Qt,我使用的是Qt5.2.0,我试图将QPushButton的文本设置为一些阿拉伯语文本,但当我运行程序时,文本显示为问号。我甚至试过: QTextCodec *codec = QTextCodec::codecForName("UTF-8"); findButton = new QPushButton(codec->toUnicode("ابدأ")); 但它仍然不起作用。任何其他解决方案?对于Qt 5.3,以下代码适用于我在Windows 7上的操作: #include <QtW
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
findButton = new QPushButton(codec->toUnicode("ابدأ"));
但它仍然不起作用。任何其他解决方案?对于Qt 5.3,以下代码适用于我在Windows 7上的操作:
#include <QtWidgets>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QPushButton *findButton = new QPushButton(codec->toUnicode("ابدأ"));
findButton->show();
return app.exec();
}
#include "main.moc"
#包括
int main(int argc,char*argv[])
{
QApplication应用程序(argc、argv);
QTextCodec*codec=QTextCodec::codeforname(“UTF-8”);
QPushButton*findButton=新的QPushButton(编解码器->toUnicode(“ابدأ”);
findButton->show();
返回app.exec();
}
#包括“main.moc”
可能是这样,也可能是这样。我建议先尝试上面的代码。您是否检查过您的计算机是否安装了阿拉伯语字体并可用?是的。它有阿拉伯字体