Description
I am trying to drag and drop mimeData in a QTreeView using an QAbstractItemModel (Python 3.6), and I've stumbled upon a few different issues.
1. I originally wanted to add a Python object to my mimeData stream. But there is no QVariant in PySide2. I can see this being a problem, as I believe there is no good workaround here; you simply cannot "drop" a Python object using drag and drop without QVariant. Am I mistaken?
2. So I instead wanted to create a dictionary which I wanted to stream (using the "application/json" format). Before adding it as a string to the stream, I need to convert the dictionary to string and UTF8 encode it. I did this with json.dumps(d, ensure_ascii=False).encode('utf-8'). But in the mimeDropData, there's no clear way to decode it. In C++ you would use QString::fromUtf8(). But there's no QString type in PySide2. Unicode is not a thing in Python 3 and str() doesn't work.
3. QByteArray.data() seems broken; b = QByteArray("hi 猫") , b.data() returns b'hi \xe7' , but it should return b'hi \xe7\x8c\xab'