To change the border, you probably need to create a custom delegate that does something in this direction:
class MyDelegate : public QItemDelegate { public: MyDelegate( QObject *parent ) : QItemDelegate( parent ) { } void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const { QItemDelegate::paint( painter, option, index ); if( ) { painter->setPen( Qt::red ); painter->drawRect( option.rect ); } } }
Then you can call:
myTableWidget->setItemDelegate( new MyDelegate(this) );
You can use the QTableWidgetItem::setData() and QModelIndex::data() functions to pass the necessary information between your table and the delegate
See qt documentation for QItemDelegate
Chris source share