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

ARUN_KUMAR at denso-diam.com ARUN_KUMAR at denso-diam.com
Mon Dec 7 19:47:26 CET 2009


I think you can use the following way
tableWidgetCell->setBackground(Qbrush(QColor(Qt::color)));

Thanks & Regards,
Arun





Moises Augusto <jr.jorro at gmail.com> 
Sent by: qt-interest-bounces at trolltech.com
12/07/2009 10:26 AM

To
qt-interest at trolltech.com
cc

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






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 _______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

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


More information about the Qt-interest-old mailing list