Can't convert const *char to QChar32

Post Reply
opaque
Posts: 19
Joined: Sat Mar 28 2020 11:53 am

Can't convert const *char to QChar32

Post by opaque »

It's a g++ error message that I vaguely recall. I put it here because of plain curiosity of how to proper adapt it to Cs. I think I will revisit it in the future but now I'm about to cancel my plan to adapt Lazarus' Qt5 binding to Cs as I think I have more to learn about Object Pascal.

The original code is here: https://github.com/graemeg/lazarus/blob/upstream/lcl/interfaces/qt5/cbindings/src/pascalbind.h

The problematic code:

Code: Select all

inline void copyQStringToPWideString(const QString &qs, PWideString ps)
{
if (qs!=0 && ps) copyUnicodeToPWideString(qs.unicode(), ps, qs.length());
}


inline void copyPWideStringToQString(PWideString ps, QString &qs)
{
  qs.setUtf16((ushort *)unicodeOfPWideString(ps),
    lengthOfPWideString(ps));
}
I translated these line according to the migration guide (https://www.copperspice.com/docs/cs_api_1.6/class_qstring8.html#migration-qstring) into:

Code: Select all

inline void copyQStringToPWideString(const QString &qs, PWideString ps)
{
if (qs!=0 && ps) copyUnicodeToPWideString(qs.constData(), ps, qs.length());
}


inline void copyPWideStringToQString(PWideString ps, QString &qs)
{
  qs.fromUtf16((ushort *)unicodeOfPWideString(ps),
    lengthOfPWideString(ps));
}
And g++ give this error message.

Post Reply