I have a QlistView
inside is which a checkboxes (created dynamically) with item name (QstandardItem
). And below Qlistview
is a checkbox named DatacheckercheckBox1
. What I want is when this DatacheckercheckBox1
checkbox statechanges to "Checked", all the checkboxes inside the QlistView
should be checked. I have made a signal for DatacheckercheckBox1
checkbox by
self.dlg.DatacheckercheckBox1.stateChanged.connect(self.selectAll)
i dont have idea in writing a method that should iterate all the items inside Qlistview
and make the checkboxes next to it "Checked" if its not checked already.
Use the model to iterate over the items:
model = self.listView.model()
for index in range(model.rowCount()):
item = model.item(index)
if item.isCheckable() and item.checkState() == QtCore.Qt.Unchecked:
item.setCheckState(QtCore.Qt.Checked)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With