Convert WCHAR to QString in Qt
Asked Answered
S

1

15

Convert WCHAR to QString in Qt. Please help me to implement it to complete this convertion.

Solatium answered 7/11, 2011 at 18:5 Comment(0)
S
31

There are to/from WCharArray methods that are static members of QString:

http://doc.qt.io/qt-4.8/qstring.html#fromWCharArray

http://doc.qt.io/qt-4.8/qstring.html#toWCharArray

Spiegleman answered 7/11, 2011 at 18:10 Comment(3)
@ShafikYaghmour Thanks for the heads-up. Fixed 'em. But I sure wish these guys would have read Tim's Cool URIs don't change. :-/Spiegleman
You might want to consider editing to include an example as well.Geis
QString::fromUtf16() also works. I was getting linking errors in QT 5 on using QString::fromWCharArray(). see forum.qt.io/post/165335. Linking error I was getting - unresolved external symbol "__declspec(dllimport) public: static class QString __cdecl QString::fromWCharArray(unsigned short const *,int)" (__imp_?fromWCharArray@QString@@SA?AV1@PBGH@Z)Cypher

© 2022 - 2024 — McMap. All rights reserved.