[PyQt] Type map for python to Qt?
Barry Scott
barry at barrys-emacs.org
Sun Feb 5 17:37:43 GMT 2017
> On 5 Feb 2017, at 12:18, Shaheed Haque <srhaque at theiet.org> wrote:
>
> The use of unions is really limited: across the whole of my /usr/include/KF5, I see 5 in one component called kjs (some Javascript interpreter thing by the looks of it). From a superficial look, it really does look like the polymorphic case but there is no obvious/explicit "what_type" in any of those case.
Maybe there is a type field in each member of the union that allows the decode, it must be possible.
Of course if the kjs component is not interesting to the python land ignore it.
>
> That said, my basic thinking is to assume that the reader/writer knows what they are doing AND that from a SIP perspective, all I need is to provide Python access to the storage. So, for access to the individual members of the union, all I need do is take care of the change in representation between a C++ int/float/whatever and the corresponding Python object. That then leaves the union itself: there it seems to me that just doing a C++ memcpy in one direction or the other is all that is required. I *think* that pretty much covers the bases…
Is that really robust to avoid crashes?
Barry
More information about the PyQt
mailing list