Show only Icon in QTableview cell

Hi,

I am starting out on learning pyQT5 and building an app that require the use of QTableview. I need help to understand how I can suppress the text or Boolean values, and just display the icons in the cell of QTableView.

I will be grateful if someone can show me a working model of how it works. With a working model, I believe I can understand the code and how things works. Thanks.

you need to change the DisplayTole data returned from the model…

add these 2 lines to data function:

if role==Qt.DisplayRole and isinstance(self._data[index.row(), index.column()], bool):
    return None
1 Like