PDA

View Full Version : How to check the background color of a certain QTableWidget cell



Garret
23rd March 2009, 18:10
Hi,

I have a litte trouble reading the background color of a QTableWidget cell.

everytime I use this:

this->myqtablewidget->itemAt(10, 3)->background().color()

it just reads the data from cell 0,0, and not 10,3 or anything else.

So whats the right way to check the background color of a cell? What do I wrong?

I thought of something like:

if(this->qtablewidget->itemAt( anyx(), anyy() )->background().color() == Qt::green)
dusomething();

janus
23rd March 2009, 21:36
Hi,

isn't it item(row, col) instead of itemAt()?