[Qt-interest] How to convert a LPCTSTR into a QString

Gabriel M. Beddingfield gabrbedd at gmail.com
Wed Jun 16 23:29:58 CEST 2010



On Wed, 16 Jun 2010, Matthias Pospiech wrote:

> void Controller::Error(LPCTSTR errorMessage)
> {
>    emit errorOccurred(QString::fromLocal8Bit(errorMessage));
> }
>
> I get the error:
> error: no matching function for call to 'QString::fromLocal8Bit(const
> TCHAR*&)'
>
> what should the solution look like?

TCHAR is a wchar*, isn't it?

Have you tried QString::fromWCharArray()?

-gabriel




More information about the Qt-interest-old mailing list