Am 05.11.2011 um 14:48 schrieb Phil Thompson: > On Sat, 5 Nov 2011 10:05:45 +0100, Detlev Offenbach > <det...@die-offenbachs.de> wrote: >> Am 04.11.2011 um 18:04 schrieb Phil Thompson: >> >>> On Fri, 4 Nov 2011 11:23:07 +0100, Detlev Offenbach >>> <det...@die-offenbachs.de> wrote: >>>> Hello, >>>> >>>> I am defining a signal in one of my classes like this. >>>> >>>> tabRelocateRequested = pyqtSignal(int, int, int) >>>> >>>> When this signal is emitted, the first parameter is bigger than an int >>>> (e.g. by using id()). This causes the signal receiver to get a first >>>> parameter, that is different to the value given in the emit call. How >>> can I >>>> correct my code (code i within eric4/5). >>> >>> Use long instead of int? >> >> Python3 (forgot to mention that) doesn't know about long anymore. Maybe >> the pyqtSignal code should work with long instead of int? > > The current behaviour is intentional as I considered this to be the least > surprising when using a signal defined in Python in C++ code. Thinking > about it now this is probably a very minor use case. > > At the moment a Python v2 int (actually implemented as a C++ long), a > Python v2 long and a Python v3 int are all mapped to a C++ int. > > Maybe a better mapping should be Python v2 int to a C++ long, and a Python > v2 long and a Python v3 int to a C++ long long.
I would opt for that solution. > However it would still be > possible to lose data for very big values - the only way to avoid that > would be to pass the Python object itself which would make it impossible to > reuse the class defining the signal from C++ code. > > As a work around you can always specify the C++ type as a string, eg. > "long long". In the mean time I implemented a workaround by converting to a str and in the receiver back to int. This preserves the value in Python3. I found another similar issue with QByteArray.number(). > > Thoughts? > > Phil > _______________________________________________ > PyQt mailing list PyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt Detlev Offenbach det...@die-offenbachs.de _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt