Setting header data in QTableView

Colin McPhail colin.mcphail at mac.com
Sun Feb 7 11:47:33 GMT 2021



> On 7 Feb 2021, at 10:16, Colin McPhail <colin.mcphail at mac.com> wrote:
> 
> 
> 
> I believe that in class TableModel instead of calling the inherited setHeaderData() method you must provide your own implementation of it. Perhaps something like
> 
>     def headerData(self, section, orientation, role):
>         if orientation == Qt.Vertical:
>             return None
>         elif role == Qt.DisplayRole:
>             return "Column " + str(section)
>         else:
>             return None
> 
Oops, please disregard my previous reply. I should have read your question more closely.
Sorry.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210207/a6631615/attachment.htm>


More information about the PyQt mailing list