Hi There, can comeone give me a hint on how to use the QString::data() ?

As I know from the Documentation Qt stores strings internally as Unicode. So my question is: Can I use the Pointer returned by data() as a pointer to WCHAR (wchar_t) ?

Qt Code:
  1. static void toWideChar(const QString& qsIn, LPWSTR* wideCharOut)
  2. {
  3. Q_ASSERT(!qsIn.isEmpty());
  4. *wideCharOut = (LPWSTR)qsIn.data();
  5. }
To copy to clipboard, switch view to plain text mode 

I found in qstring.h the ushort data pointer:

Qt Code:
  1. struct Data {
  2. QBasicAtomicInt ref;
  3. int alloc, size;
  4. ushort *data;
  5. ushort clean : 1;
  6. ushort simpletext : 1;
  7. ushort righttoleft : 1;
  8. ushort asciiCache : 1;
  9. ushort capacity : 1;
  10. ushort reserved : 11;
  11. ushort array[1];
  12. };
To copy to clipboard, switch view to plain text mode 

This Pointer will be returned as a reinterpretet QChar Pointer:
Qt Code:
  1. inline const QChar *QString::data() const
  2. { return reinterpret_cast<const QChar*>(d->data); }
To copy to clipboard, switch view to plain text mode 

All other attempts (i.e. toWCharArray()) seem to copy all the content and this is what I try to avoid.

Any Commtents (however, even good practive-hints) ? Thanks.