PDA

View Full Version : QTableWidget with checkboxes.



chris_helloworld
13th January 2011, 15:42
Hi guys,

I have a QTableWidget with checkboxes in the 1st column. I have a button to 'select all' which is implemented,



for(int i = 0; i < tableWidget->rowCount(); i++) {
QTableWidgetItem *twi = tableWidget->item(i, 0);
twi->setCheckState(Qt::Checked);
}


I'm finding that the 1st checkbox in my table doesnt get properly updated. (Subsequently checking on another row cause it to be displayed properly). I tried calling
tableWidget->repaint afterwards but this doesnt fix my problem.

I'm sure I'm doing something dumb, (1/2 asleep due to new baby), any help appreciated.

Cheers,
Chris.

Added after 22 minutes:

Answering my own questions.
Theres a bug in Qt http://bugreports.qt.nokia.com/browse/QTBUG-5042

To resolve I call


tableWidget->verticalHeader()->show();
tableWidget->verticalHeader()->hide();