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

List:       pykde
Subject:    [PyQt] QWidget 'destroyed' signal: possible regression?
From:       Pierre Raybaut <pierre.raybaut () gmail ! com>
Date:       2012-02-26 15:23:26
Message-ID: CAKegKuC7JBEErdABZa2bO2Ef87zjy5X+mRS=0e41B_YHPkTBdg () mail ! gmail ! com
[Download RAW message or body]

Hi Phil,

I recently found out that a feature succesfully tested with older
versions of PyQt was broken
(http://code.google.com/p/spyderlib/issues/detail?id=951) and at the
same time the Matplotlib developers contacted me for a similar issue
(https://github.com/matplotlib/matplotlib/issues/711).

To explain our problem, I wrote this test script:

#-----------------------------------------------------------------------------
from PyQt4.QtGui import QApplication, QWidget
from PyQt4.QtCore import Qt

def print_from_function():
    print "Callback = Function"

class TestWidget(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.destroyed.connect(print_from_function)
        self.destroyed.connect(self.print_from_method)
        self.destroyed.connect(self.print_from_static_method)
        self.destroyed.connect(lambda: self.print_from_lambda_function())
        self.setAttribute(Qt.WA_DeleteOnClose)

    def print_from_method(self):
        print "Callback = method"

    @staticmethod
    def print_from_static_method(self):
        print "Callback = static method"

    def print_from_lambda_function(self):
        print "Callback = lambda function"

app = QApplication([])
widget = TestWidget()
widget.show()
app.exec_()
#-----------------------------------------------------------------------------

The issue with the test script above is that all callbacks connected
to the 'destroyed' signal are triggered except for the callback which
is a method (bound to the object to be destroyed).

So the question is: is this a regression from PyQt v4.8.5? (or earlier)

Thanks,
-Pierre
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

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