Hi,
I've discovered some very strange behaviour when trying to delete a QWidget from a QGridLayout. The following code demonstrates this behaviour:
>>> from PyQt4 import QtGui
>>> import sys
>>> app = QtGui.QApplication(sys.argv)
>>> grid_layout = QtGui.QGridLayout()
>>> grid_layout.addWidget(QtGui.QWidget())
>>> item = self.grid_layout.takeAt(0)
>>> item.deleteLater()
>>> grid_layout.addWidget(QtGui.QWidget())
>>> item = self.grid_layout.takeAt(0)
>>> item.deleteLater()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'QWidgetItem' object has no attribute 'deleteLater'
File "<stdin>", line 1, in <module>
AttributeError: 'QWidgetItem' object has no attribute 'deleteLater'
This makes no sense to me whatsoever. Firstly, why is it returning a QWidgetItem when I inserted a QWidget to begin with? Secondly, every Qt object derives from QObject, and deleteLater() is a method of QObject, so that method should exist. Additional info:
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
[GCC 4.8.2] on linux2
using PyQt4
-- https://mail.python.org/mailman/listinfo/python-list