Skip to content Skip to sidebar Skip to footer

Issue With My Check Box In Pyqt And Python

I have a checkbox named 'selectAllCheckBox'. When this in checked state, all the checkboxes(created dynamically) inside the listview should change to checked state and when 'select

Solution 1:

The stateChanged signal sends the checked state, so the slot could be re-written as:

defselectAll(self, state=QtCore.Qt.Checked):
    """Select All layers loaded inside the listView"""

    model = self.dlg.selectAllCheckBox.model()
    for index inrange(model.rowCount()):
        item = model.item(index)
        if item.isCheckable():
            item.setCheckState(state)

(NB: if all the rows in the list-view have checkboxes, the isCheckable line could be omitted)

Post a Comment for "Issue With My Check Box In Pyqt And Python"