[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: Has the signal-slot behavior changed?
From:       Detlev Offenbach <detlev () die-offenbachs ! de>
Date:       2023-05-26 11:10:02
Message-ID: 73dfb1a8-9308-97d0-a8e4-d738c367c2b5 () die-offenbachs ! de
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]

[Attachment #4 (multipart/mixed)]

[Attachment #6 (text/plain)]


Am 26.05.23 um 13:06 schrieb Phil Thompson:
> On 25/05/2023 12:32, Detlev Offenbach wrote:
>> Am 25.05.23 um 12:19 schrieb Phil Thompson:
>>> On 25/05/2023 10:59, Detlev Offenbach wrote:
>>>> Hi,
>>>>
>>>> I am observing a strange behavior with the eric-ide code.
>>>>
>>>> Before upgrading to the latest PyQt6 version the following code was 
>>>> OK.
>>>>
>>>>     @pyqtSlot(float)
>>>>     def setZoomFactor(self, zoomFactor):
>>>>         <some code here>
>>>>
>>>> But with latest PyQt6/Qt6 it fails telling me, that the slot signature
>>>> (float) is not compatible. I had to change it like this
>>>>
>>>>     @pyqtSlot(float)
>>>>     @pyqtSlot("qreal")
>>>>     def setZoomFactor(self, zoomFactor):
>>>>         <some code here>
>>>>
>>>> What did I miss in the past?
>>>
>>> What signal are you connecting it to?
>>
>> QPdfView.zoomFactorChanged(qreal zoomFactor)
>>
>> Detlev
>>
>> PS: Similar thing happens with QGraphicsScene.changed(const
>> QList<QRectF> &region). I have to define a slot to be connected to
>> this signal with
>>
>> @pyqtSlot("QList<QRectF>")
>
> Fixed in the next snapshot. I'll release v6.5.1 some time next week.
>
> Personally I don't see much point in using pyqtSlot() unless you want 
> to expose a Python object to other C++ code.

... or you want to ensure the correct argument types. Some signals are 
even emitted multiple times with different signatures and by using 
pyqtSlot() you make sure, the correct signal type was connected.

Detlev

-- 
Detlev Offenbach
detlev@die-offenbachs.de


["OpenPGP_0xBD1F26A5DA8A6150.asc" (application/pgp-keys)]
["OpenPGP_signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic