PDA

View Full Version : How to set verticalHeader() indexing for QTableWidget ?



balazsbela
30th July 2007, 13:01
So I have a QTableWidget. The vertical header has no labels set, therefore qt4 numbers the rows automatically from 1. I would like to set that numbering to start from 0 without having to make a new QStringList to use with setVerticalHeaderLabels and to update it frequently when a new row is added.
How can this be done ?

marcel
30th July 2007, 13:06
I am not sure, but what about QTableWidget::verticalHeaderItem? You could update the text for the last added item each time you add a new row.

For example, when you add the first row, you update the header to display 0, not 1.
I am not sure though how this works with updates, but I tend to believe it works.

So each time you add a new row you only need to update the header for that row.

Regards

balazsbela
30th July 2007, 13:48
Yeah I thought of that previously but I wondered if there is an easyer way.

marcel
30th July 2007, 13:49
No, that is why you have setVerticalHeaderLabels.

Regards