[PyQt] No QString::fromUtf16, what instead?

Filip Gruszczyński gruszczy at gmail.com
Wed Dec 24 23:35:36 GMT 2008


Hi!

I am trying to retrieve filepath from icon drop on Windows. There is
format application/x-qt-windows-mime;value="FileNameW", which holds
proper path (there is also
application/x-qt-windows-mime;value="FileName", but it returns some
kind of abbreviated path, where each part is 8 chars long, argh, I
don't know this windows stuff). I can't turn it into a nice string -
what I get is string with spaces, because of zeroes in wchar. How can
I convert it easily into a QString? For Qt there is fromUtf16 or
fromUcs2, although none of them gets byte array. What should I use
with PyQt? There is only one constructor, which takes byte array, but
i expects Ansi Chars, so stops after first character. How can I easily
convert it to QString (or, even better, to a python string)?

-- 
Filip Gruszczyński



More information about the PyQt mailing list