[PyQt] QTableView with checkbox headers
Sherif Shehab Aldin
silentquote at gmail.com
Mon Jan 2 11:28:09 GMT 2012
Hi,
I am trying to have a QTableView of checkboxes, so I can use them for row
selections... I have managed to do that, now I want the header Itself to be
checkbox so I can check/Uncheck All. I have been looking for days, but
couldn't get to do it.
I tried to use setHeaderData to the model, but couldn't do it.
<-- snip -->
item = QtGui.QTableWidgetItem("Check");
item.setFlags(
QtCore.Qt.ItemIsUserCheckable|QtCore.Qt.ItemIsEnabled )
item.setCheckState(QtCore.Qt.Unchecked)
model.setHeaderData(0, QtCore.Qt.Horizontal, item,
QtCore.Qt.CheckStateRole)
</-- snap -->
I am using QSqlRelationalModel for the table. Any help is much appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120102/8e1a7aae/attachment.html>
More information about the PyQt
mailing list