Some handy conversion for Qt

Hello,

Long time since my last post, I’m not dead only extremely busy with work!🙂

Here a little handy collection of String Formats Conversions from/to Qt:

#ifdef UNICODE

#define QStringToTCHAR(x) (wchar_t*) x.utf16()

#define PQStringToTCHAR(x) (wchar_t*) x->utf16()

#define TCHARToQString(x) QString::fromUtf16((x))

#define TCHARToQStringN(x,y) QString::fromUtf16((x),(y))

#else

#define QStringToTCHAR(x) x.local8Bit().constData()

#define PQStringToTCHAR(x) x->local8Bit().constData()

#define TCHARToQString(x) QString::fromLocal8Bit((x))

#define TCHARToQStringN(x,y) QString::fromLocal8Bit((x),(y))

#endif

see you to the next post..🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: