On Sunday 16 September 2007, Hans-Peter Jansen wrote:
> Hi *,
>
> I stumbled upon some strange effects with signal sender() and self.name()
> properties in PyQt3. I had the impression, the latter is available
> immediately after calling a QObject derived constructor, while the Qt3
> documentation states:
>
> Returns a pointer to the object that sent the signal, if called in a slot
> activated by a signal; otherwise it returns 0. The pointer is valid only
> during the execution of the slot that calls this function.
> The pointer returned by this function becomes invalid if the sender is
> destroyed, or if the slot is disconnected from the sender's signal.
>
> Hmm, that doesn't explain the effects I'm suffering from.
>
> Here's code, that tries to exercise these issues:
>
...
>
> The sender resolves to an empty string and empty type inside the text edit:
>
> unnamed ready [(None, 'catcher')]
> emitter added
> timer added
>  (): counter 1 catched
>  (): timer catched
>  (): counter 2 catched
>  (): timer catched
>  (): counter 3 catched
>
> while it resolves either to some QTimer objects for both signals (the
> python and Qt one) in the no arg case on the console:
>
> <qt.QTimer object at 0xb679502c> <class 'qt.QTimer'>
> <qt.QTimer object at 0xb679505c> <class 'qt.QTimer'>
> <qt.QTimer object at 0xb679502c> <class 'qt.QTimer'>
> <qt.QTimer object at 0xb679505c> <class 'qt.QTimer'>
>
> In the command line arg case, it's missing the PYSIGNAL name and the types,
> too:
>
> unnamed ready [(None, 'catcher')]
> emitter added
> timer added
> unnamed (): counter 1 catched
> timer (): timer catched
> unnamed (): counter 2 catched
> timer (): timer catched
> unnamed (): counter 3 catched
> timer (): timer catched
>
> On the console, it shows the expected output (except the "unnamed" issue):
>
> unnamed <type 'str'>
> timer <type 'str'>
> unnamed <type 'str'>
> timer <type 'str'>
> unnamed <type 'str'>
> timer <type 'str'>
>
> I'm baffled on this one. I'm expecting the some QObjects in both the
> console and the text edit for the first case, while the correct name()s for
> the second..
>
> Distribution: openSUSE 10.2, consisting of:
> Python version: 2.5
> sip version: 4.2.1
> Qt version: 3.3.7
> PyQt version: 3.14.1
>
> Could somebody in this kind audience shed some light on these issues,
> please? (or is this simply due to the dusty versions..)

Dusty versions - I think.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to