This doesn't solve your problem, but as a general rule I would
recommend that you recycle widgets instead of deleting them. Hide and
cache the widgets you want removed, and reuse and re-init them when
you need them.
But, there is a W_DestructiveClose (or similar) widget flag that
deletes the widget when it is closed. look into that. You need to make
sure all of the python references to the widget are gone before it
will be deleted, and this *may* or may not include disconnecting
signal/slot connections.
On 6/12/06, Daryl Dusheiko <[EMAIL PROTECTED]> wrote:
Hi,
I am adding and removing QCheckBoxes to/from a QButtonGroup dynamically.
When I remove the checkbox I would also like it removed from the GUI.
I am seeing two different behaviors when using Linux or when using
windows. The qt version in windows is 3.3.1, the version in Linux is 3.3.4.
On Linux the item is removed as I expect, but after removing and adding
a number of widgets when I exit the program I get a segment error.
On windows nothing is removed, I also don't get a segment error when I
exit the application.
My question is how can I delete an item from a QButtonGroup and have it
removed from the GUI?
My code is as follows:
# Remove check boxes
self.testGroupLayout.deleteAllItems()
childList = self.moduleTestsButtonGroup.children()
for child in childList:
if type(child) == QCheckBox:
self.moduleTestsButtonGroup.remove(child)
self.moduleTestsButtonGroup.removeChild(child)
del child
# Add check boxes
for test in self.module.tests:
checkBox = QCheckBox(test.name, self.moduleTestsButtonGroup)
self.testGroupLayout.addWidget(checkBox)
QToolTip.add(checkBox,test.__doc__)
checkBox.setChecked(True)
checkBox.show()
test.enabled = True
self.moduleTestsButtonGroup.update()
Cheers
Daryl
_______________________________________________
PyKDE mailing list [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
--
Patrick Kidd Stinson
http://www.patrickkidd.com/
http://pkaudio.sourceforge.net/
http://pksampler.sourceforge.net/
_______________________________________________
PyKDE mailing list [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde