[PyKDE] Deleting an item from a QButtonGroup

Daryl Dusheiko daryld at magtech.com.au
Tue Jun 13 02:48:03 BST 2006


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: daryld.vcf
Type: text/x-vcard
Size: 237 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20060613/6d87f0b8/daryld.vcf


More information about the PyQt mailing list