[Qt-interest] QString to TCHAR* and back
Duane Hebert
spoo at flarn.com
Wed Feb 24 17:17:35 CET 2010
What is the recommend way to do these conversions?
If found this on the net and it seems to work:
#ifdef UNICODE
#define QStringToTCHAR(x) (wchar_t*) x.utf16()
#define TCHARToQString(x) QString::fromUtf16((x))
#else
#define QStringToTCHAR(x) x.local8Bit().constData()
#define TCHARToQString(x) QString::fromLocal8Bit((x))
#endif
I'm using Qt 4.5.1 win commercial.
More information about the Qt-interest-old
mailing list