Unsolved Deserialization of QHash in PySide2
-
Hello all
I'm starting with python for Qt and have quick question. How do you represent QList/QHash - I expect that these are "natural" python structures. But in that case I'm struggling a bit with deserialization of data. I have C++ application that stores some data that could be later read in C++ as (after some trivial reading of magic, version, ...):
QVariantHash header; in >> header; // 'in' is a QDataStream
How would one do that in python? Direct translation (with
header
being empty dictionary) results in an error that__rshift__
accepts only following:PySide2.QtCore.QBitArray PySide2.QtCore.QByteArray PySide2.QtCore.QDate PySide2.QtCore.QDateTime PySide2.QtCore.QEasingCurve PySide2.QtCore.QLine PySide2.QtCore.QLineF PySide2.QtCore.QLocale PySide2.QtCore.QMargins PySide2.QtCore.QMarginsF PySide2.QtCore.QPoint PySide2.QtCore.QPointF PySide2.QtCore.QRect PySide2.QtCore.QRectF PySide2.QtCore.QSize PySide2.QtCore.QSizeF PySide2.QtCore.QTime PySide2.QtCore.QUrl PySide2.QtCore.QUuid PySide2.QtCore.QRegularExpression PySide2.QtCore.QRegExp PySide2.QtCore.QTimeZone PySide2.QtCore.QVersionNumber
and there is no
QDataStream.readHash
or something like that. Do I need to take a peek at how it is done and do it myself by pieces (would prefer not to rely on the particular implementation - which could change between Qt versions).I'd appreciate some help with this.
With regards
Andrzej -
Hi,
Interesting use case. I would recommend asking this question to the PySide mailing list. You'll find there PySide2 developers/maintainers. This forum is more user oriented.