QTableWidget: different styles in *one* QTableWidgetItem?
Is it possible to have a two-line element in a cell (QTableWidgetItem) of a QTableWidget with different styles per line? I want to have the first line bold and the second line not bold. Or can I add two QTableWidgetItems in one cell? Do a cellspan somehow?
Cheers 开发者_开发问答Matthias
Simple way :
Checkout the setCellWidget method of QTableWidget.
If you replace the default widget with QTextEdit, you can get rich text formatting capability.
Better way :
Use a custom QStyledItemDelegate. You can see an example here
I hope this helps.
精彩评论