[PyQt] Type map for python to Qt?
russ at perspexis.com
Thu Feb 2 17:02:37 GMT 2017
> Conversions are implemented only if there is a direct equivalent,
> everything else gets converted to a PyQt_PyObject. You could perhaps make
> the case for the date/time types.
datetime definitely might be nice, but the one I'd more likely want to make
a case for is tuples. I'm having to make some changes to deal with that
The issue is that if a dict is converted to a QVariant and sent to QML, any
tuples in the dict hierarchy aren't getting converted properly since PyQt
is leaving them as `PyQt_PyObject`, which QML obviously has no clue what to
do with. Right now I'm trying to determine the best way to deal with
this... might require recursively searching such dicts for tuples and
converting to lists prior to shipping to QML as a `QVariant`. If PyQt
converted tuples into `QVariantList` there would no need for this.
Is there a reason tuples don't get translated to QVariantList, just like
lists do? Immutability concerns, maybe?
Also, fwiw, python `bytes` could also potentially translate to
`QByteArray`. Never used that (I'm fairly new to Qt), but it seems
equivalent at least. It also isn't in the Qt->QML translation table , so
is of less interest.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt