简体   繁体   中英

PySide2 new Signal and Slot connection

There was a recent update in PySide2 and now all of my apps are broken. I have code like this...

from PySide2.QtCore import *                                                   

class Saver(QObject):                                                                               

    doneSaving = Signal()                                                      

    def __init__(self, app, signaller, param, items):                             
        """Constructor"""                                                         
        super(Saver, self).__init__()                                             

        self.app = app                                                            
        self.param = param                                                        
        self.items = items                                                        

        sig = app.getSignaller(signaller)                                         
        help(sig.valueAvailable)                                                  
        sig.valueAvailable.connect(self.dataReceived)                                         

        self.saving = False

And it recently stopped working because apparently QtCore.Signal() no longer has an attribute called connect. I've looked through the docs but can't find anything.

Does any one know the new syntax to connect signals and slots in PySide2?

I finally resolved this. I had jumped the gun in thinking that it was the API that had changed. My app is using Shiboken to wrap some C++ stuff and it was those shared objects which had changed.

After recompiling all the wrappers everything started working again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM