[PyQt] QWidget event == no more GC for QWidget?

Alexei Puzikov puzikov at gmail.com
Tue Jul 22 00:44:11 BST 2008


Hello,

Quick question: if I uncomment the moveEvent in the code below, the
destructor isn't called anymore.
I suspect I'm doing something wrong or missing something - anybody can
clear the things up?

I'm on Python 2.5.1 (r251:54863, Jun 25 2008, 10:21:16)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2

>>> QtCore.PYQT_VERSION_STR
'4.3.3'

Thanks

Alexei

#################################################################

import sys
from PyQt4 import QtCore, QtGui

class Window(QtGui.QWidget):
   def __init__(self, selectedShader = None):
       QtGui.QWidget.__init__(self, None)
       #self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
       self.resize(QtCore.QSize(QtCore.QRect(0,0,400,300).size()).expandedTo(self.minimumSizeHint()))

   def __del__(self):
       print "Window destructor called"

   #def moveEvent(self, event):
       #print "move"

app = QtGui.QApplication(sys.argv)
window = Window()
window.show()
app.exec_()


More information about the PyQt mailing list