For example, it is very troublesome to display the Chinese character of QT. You need to use the local encoding method and then obtain the string. Attached file operations, file writing also supports Chinese:
# Include <qtwidgets/qapplication> # include <qfiledialog> # include <qtextcodec> # include <qtextstream> int main (INT argc, char * argv []) {qapplication A (argc, argv); qstring STR; STR = Str. fromlocal8bit ("dinner"); qtextcodec * codec = qtextcodec: codecforlocale (); qstring AA = codec-> tounicode ("QT Chinese display"); qt2 W; W. show (); qstring dir = qfiledialog: getexistingdirectory (& W, STR, "C:"); qstring wrfile = qfiledia Log: getsavefilename (& W, AA, DIR); qstringlist open = qfiledialog: getopenfilenames (& W, "open files", "d: \ c_proj "); qfile file (wrfile); If (! File. open (qiodevice: writeonly | qiodevice: Text) return 1; qtextstream out (& file); out <"the magic number is: "<49 <" \ n "; out <AA <Endl; For (qstringlist: iterator iter = open. begin (); iter! = Open. End (); ITER ++) {out <* ITER <Endl;} return a.exe C ();}