[PySide] Deserialization of QHash

Andrzej Ostruszka andrzej.ostruszka at gmail.com
Tue Mar 17 11:16:25 CET 2020


Hello all

I'm new to the mailing list and have a specific question - was directed
here from Qt Forum:

https://forum.qt.io/topic/112600/deserialization-of-qhash-in-pyside2

So to repeat myself how would I read data from QDataStream if it was
saved to file via:

QVariantHash header;
QDataStream ds;
...
ds << header;
...

Somehow I can't figure out how to read QHash (the same probably would
apply to QList too).  In PySide2 QDataStream I see options to read
single items (ints, floats, QVariant, ...) and for collections only
QStringList is there.  So how would you read QList<int> or
QHash<QString,double> or my particular case QHash<QString, QVariant>.

How QHash/QList are represented on python side - via natural python data
structures?

I'd appreciate some help with this.

With regards
Andrzej Ostruszka


More information about the PySide mailing list