问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/6438447/qtablewidget-different-styles-in-one-qtablewidgetitem