furskytl
4th October 2011, 14:08
I am really confused about displaying Chinese!
First,my windows' language is Chinese.To display Chinese in my app,I searched the Internet and found that I could add the following code to my app and used tr() where I wanted to display Chinese.
QTextCodec::setCodecForTr(QTextCodec::codecForName ("GBK"));
To my release,it really worked very well.However,when I opened my app in my friend's computer,it did't work correctly.My friend's os is also win xp in Chinese!
Then I added the following codes to my app rather than the former one.
QTextCodec::setCodecForCStrings(QTextCodec::codecF orLocale());
QTextCodec::setCodecForTr(QTextCodec::codecForLoca le());
It works perfectly whether on my computer or my friend's.
What happens?
And if I run this app on an English os,can it work correctly?If not,what should I do?Thanks!
First,my windows' language is Chinese.To display Chinese in my app,I searched the Internet and found that I could add the following code to my app and used tr() where I wanted to display Chinese.
QTextCodec::setCodecForTr(QTextCodec::codecForName ("GBK"));
To my release,it really worked very well.However,when I opened my app in my friend's computer,it did't work correctly.My friend's os is also win xp in Chinese!
Then I added the following codes to my app rather than the former one.
QTextCodec::setCodecForCStrings(QTextCodec::codecF orLocale());
QTextCodec::setCodecForTr(QTextCodec::codecForLoca le());
It works perfectly whether on my computer or my friend's.
What happens?
And if I run this app on an English os,can it work correctly?If not,what should I do?Thanks!