Weichen
18th September 2010, 17:30
Hello, I am new to the QT SDK 4.6.1 and currently learning qt through C++-GUI-Programming-with-Qt-4-1st-ed
I am trying to display some chinese words in a simple qt windows and it shows up all rubbish.
here is the code
#include <QApplication>
#include <QLabel>
int main( int argc, char* argv[])
{
QApplication App(argc,argv);
QLabel *label = new QLabel("XXXX"); //where XXXX is chinese character
label -> show();
return app.exec()
}
The code ran well and showed a little windows, the only problem is that the chinese character are messed up.
It would be nice if someone can show me how to solve these problems or I might as well just go back to MFC.
ps.
I've been search through internet for solutions; however, nothing mentionable has been found. I've read the internationlization with QT and tried
QString text = "XXXX";
QLabel *label = new QLabel(text);
and it did not work. I donno the tr() function as there is no real example that solved the multi-langue display problem
I am trying to display some chinese words in a simple qt windows and it shows up all rubbish.
here is the code
#include <QApplication>
#include <QLabel>
int main( int argc, char* argv[])
{
QApplication App(argc,argv);
QLabel *label = new QLabel("XXXX"); //where XXXX is chinese character
label -> show();
return app.exec()
}
The code ran well and showed a little windows, the only problem is that the chinese character are messed up.
It would be nice if someone can show me how to solve these problems or I might as well just go back to MFC.
ps.
I've been search through internet for solutions; however, nothing mentionable has been found. I've read the internationlization with QT and tried
QString text = "XXXX";
QLabel *label = new QLabel(text);
and it did not work. I donno the tr() function as there is no real example that solved the multi-langue display problem