Bagstone
2nd July 2008, 19:41
Hi,
I use a QTableView connected to a QStandardItemModel. The view's
headers start counting at one, but I need them to start counting at
zero, so I changed them manually (with setHeaderData function, worked
like a charm).
But when I change my rootIndex, it gets messed up. Here's an example
to explain my problem:
I've got one single valid item in the model's table (at 0,0 ofcourse).
Now I change my rootIndex to this index, such that the sub-table
located in the first element of the superior table is the one
displayed in the itemview. I add some rows and columns to the
sub-table, everything seems ok. But when I call setHeaderData, there
is a check in QStandardItemModel::setHeaderData if the header section
number I want to change is valid. It checks if the the given integer
value is smaller than rowCount() (respective columnCount()). In my
opinion, this should be rowCount(rootIndex)... than I would be able to
edit it again.
Is this a known bug, or working as intended, or did I miss something?
I'm using Qt 4.3.x (x=3 or x=4, don't know exactly, I'm not at my work
PC at the moment).
Thanks,
Bag
I use a QTableView connected to a QStandardItemModel. The view's
headers start counting at one, but I need them to start counting at
zero, so I changed them manually (with setHeaderData function, worked
like a charm).
But when I change my rootIndex, it gets messed up. Here's an example
to explain my problem:
I've got one single valid item in the model's table (at 0,0 ofcourse).
Now I change my rootIndex to this index, such that the sub-table
located in the first element of the superior table is the one
displayed in the itemview. I add some rows and columns to the
sub-table, everything seems ok. But when I call setHeaderData, there
is a check in QStandardItemModel::setHeaderData if the header section
number I want to change is valid. It checks if the the given integer
value is smaller than rowCount() (respective columnCount()). In my
opinion, this should be rowCount(rootIndex)... than I would be able to
edit it again.
Is this a known bug, or working as intended, or did I miss something?
I'm using Qt 4.3.x (x=3 or x=4, don't know exactly, I'm not at my work
PC at the moment).
Thanks,
Bag