[Solved]Color a QTableWidget cell



  • I'm trying to color a cell from a QTableWidget but it seams that I'm doing something wrong because is not working( fails silently ), what is my mistake?

    @QTableWidget* tableWidget = new QTableWidget( parent );
    tableWidget->setRowCount( 8 );
    tableWidget->setColumnCount( 10 );

    QColor color( Qt::red );
    tableWidget->item( 0, 0 )->setBackgroundColor( color );@



  • Found the problem, it was needed to cal tableWidget->setItem( 0,0, tableItem ) to add an item to tableWidget


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.