The string in the interface, try to use QOBJECT::TR (text); To convert the interface language later, even if you don't think about it now.
Method One:
Use each time you set:
Button->settext (Qapplication::translate ("", "OK?", 0, Qapplication::unicodeutf8));
This method is too troublesome.
Method Two:
Called in the main function:
QTEXTCODEC::SETCODECFORTR (Qtextcodec::codecforname ("UTF8"));
Qtextcodec::setcodecforcstrings (Qtextcodec::codecforname ("UTF8"));
Then use the interface:
Button->settext (Qobject::tr ("How are You?"));
Method Two is convenient, only need to set one time in the main function.
Method Three:
Direct use:
Button->settext (Qobject::trutf8 ("How are You?"));
Similar to law two.
Http://www.cppblog.com/biao/archive/2009/03/30/78343.html
Qt: Use Chinese in the interface (three methods, qapplication::translate can specify encoding)