[Qt-interest] set backgrou color in cell (qtablewidget)

Moises Augusto jr.jorro at gmail.com
Mon Dec 7 19:26:00 CET 2009


Hi!

please, help me in the problem.

In the cell (database) is true or false.. when true, the background collor
should be green, when false, shoulde be red (in qtablewidget).

I'm using qsqltablemodel for set table in qtablewidget:

 1
2
3
4
5
6
7

model->setTable("table1");
model->setFilter("id = " + grp.id);
model->setHeaderData(1,Qt::Horizontal, tr("ID"));
model->setHeaderData(2,Qt::Horizontal, tr("NOME"));
model->setHeaderData(3,Qt::Horizontal, tr("STATUS"));
model->select();
tableview->setModel(model);

Guys, how to set background color in the cell 'STATUS' ?

regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091207/4389d2a1/attachment.html 


More information about the Qt-interest-old mailing list