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

Moises Augusto jr.jorro at gmail.com
Mon Dec 7 21:14:42 CET 2009


Hi Arun,

thank's for help me.

the 'problem' is that the qsqltablemodel set all content on qtableview and i
don't know how to filter.

Moises

2009/12/7 <ARUN_KUMAR at denso-diam.com>

>
> 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/a7df7195/attachment.html 


More information about the Qt-interest-old mailing list