[PyQt] Dialog not deleted in PyQt5

Martin Altmayer martin.altmayer at web.de
Sat Apr 26 17:18:48 BST 2014


In the minimal working example in the attachment a dialog is deleted 
when using PyQt4 but not deleted when using PyQt5. Was there an intended 
change in the delete-behavior?

The example will show a single button that opens a dialog which 
connects to a signal. The signal is emitted after the dialog is accepted 
and makes the dialog print a line. In PyQt4, whenever you accept the 
dialog, you will get one line of output. In PyQt5, when you accepted the 
n-th dialog you will get n lines of output, because all n dialogs are 
still alive and listening to the signal.

As a workaround one can delete the dialog manually using deleteLater 
(depending on the version pyqtSlot might be necessary as discussed in 

Versions:  PyQt:  4.10.4-2  and 5.2.1-2    Qt: 4.8.6 and 5.2.1   SIP 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.py
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140426/13911855/attachment.ksh>

More information about the PyQt mailing list