Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在QT应用程序中显示为问号的阿拉伯文文本_C++_Qt - Fatal编程技术网

C++ 在QT应用程序中显示为问号的阿拉伯文文本

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

我使用的是Qt5.2.0,我试图将QPushButton的文本设置为一些阿拉伯语文本,但当我运行程序时,文本显示为问号。我甚至试过:

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”

可能是这样,也可能是这样。我建议先尝试上面的代码。

您是否检查过您的计算机是否安装了阿拉伯语字体并可用?是的。它有阿拉伯字体