请问大家,tablewidget有几百条目录,需要给其中几条标记颜色,如何实现?
使用void QTableWidgetItem::setData(int role, const QVariant &value),其中role用Qt::TextColorRole或Qt::BackgroundColorRole,新版本使用ForegroundRole和BackgroundRole
void QTableWidgetItem::setData(int role, const QVariant &value)
role
Qt::TextColorRole
Qt::BackgroundColorRole
ForegroundRole
BackgroundRole