PDA

View Full Version : QString and wchar_t?



jamos
15th May 2006, 18:24
Hello;

Still evaluating Qt 4.1.2. Our existing code uses Unicode strings based on wchar_t. Unfortunately, QString does not seem to recognize such strings at all; I'm getting compile errors of the form:

.\MidiOptionsDialog.cpp(28) : error C2665: 'QString::QString' : none of the 10 overloads could convert all the argument types
C:\Qt\4.1.2\include\QtCore/qstring.h(68): could be 'QString::QString(const QChar *,int)'
C:\Qt\4.1.2\include\QtCore/qstring.h(70): or 'QString::QString(int,QChar)'
C:\Qt\4.1.2\include\QtCore/qstring.h(486): or 'QString::QString(QString::Data *,int)'
while trying to match the argument list '(const wchar_t *, size_t)'

Obviously a QChar is not a wchar_t; it's a class.

Is there a way to construct a QString from a wchar_t*, without converting the string to chars?

wysota
15th May 2006, 18:32
Maybe using QString::fromStdWString ( const std::wstring & str )?

jacek
15th May 2006, 18:45
QString::fromUtf16()