Has the signal-slot behavior changed?

Phil Thompson phil at riverbankcomputing.com
Fri May 26 12:06:22 BST 2023


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.

Phil


More information about the PyQt mailing list