How to set font to bold/not-bold when clicking on a row in QTableView?

G Connor neothreeeight at
Wed Oct 26 23:25:21 BST 2022


With a QTableWidget it can be done like this:

font = QFont()
font.setBold(True) or False
for col in range(3,7):

I looked online but couldn't find how to do it for QTableView.

font = QFont()
font.setBold(True) or False
model = QTableView.model()
for col in range(3,7):
    model.setFont(model.index(row,col), font)

Throws AttributeError: 'QSqlTableModel' object has no attribute 'setFont'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the PyQt mailing list