On 10/25/2022 1:45 PM, Thomas Passin wrote:
On 10/25/2022 1:03 PM, DFS wrote:
Having problems with removeRow() on a QTableView object.

removeRow() isn't listed as being a method of a QTableView, not even an inherited method, so how are you calling removeRow() on it? (See https://doc.qt.io/qt-6/qtableview-members.html)

Since you helped me on the last one, maybe you could try to answer a couple more [probably simple] roadblocks I'm hitting.


I just wanna set the font to bold/not-bold when clicking on a row in QTableView.



With a QTableWidget I do it like this:

font = QFont()
font.setBold(True) or False
QTableWidget.item(row,col).setFont(font)



But the QTableView has data/view 'models' attached to it and that syntax doesn't work:


Tried:
font = QFont()
font.setBold(True) or False
model = QTableView.model()
model.setFont(model.index(row,col), font)

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


This doesn't throw an error, but doesn't show bold:
model.setData(model.index(tblRow, col), font, Qt.FontRole)


Any ideas?

Thanks
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to