[Qt-interest] QString to TCHAR* and back
Dan White
ygor at comcast.net
Wed Feb 24 17:26:54 CET 2010
How about QString::fromStdWString and QString::fromWCharArray and QString::toStdWString and QString::toWCharArray ?
Search for "wchar" on the QString documentation page.
“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)
----- Duane Hebert <spoo at flarn.com> wrote:
> 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.
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list