Use Qt::BackgroundRole of the model to set the color.