[PyKDE] Using QObject.disconnect

Sergey ANIKIN san at nnov.matra-dtv.fr
Thu Sep 12 16:06:01 BST 2002


I have the following QDialog-based Python class:

class SuperDialog(QDialog) :
...
    def onSelection(self) :
        <some actions>

    def onOk(self) :
        ...
        s = desktop.getSelection()
        QObject.disconnect(s, SIGNAL('selectionChanged()'), 
self.onSelection)

After SuperDialog object has been created, I connect its onSelection 
method to some signal generated by C++ object Selection:

d = SuperDialog(desktop)
s = desktop.getSelection()
QObject.connect(s, SIGNAL('selectionChanged()'), d.onSelection)

It works just fine until I press OK button. When onOk method tries to 
disconnect this dialog from Selection's signal, I get the follwoing message:

File "SuperGUI.py", line 184, in onOk
    QObject.disconnect(s, SIGNAL('selectionChanged()'), self.onSelection)
RuntimeError: Slot hasn't been connected 

Unfortunately, PyQt docs provide very poor description of "disconnect" 
usage.
Therefore, could anybody give me an advice how to disconnect dialog's 
slot from its onOk method? Maybe Phil? ;)

Best regards,
Sergey




More information about the PyQt mailing list