Urgent help required !!! How to read the tableview index number?
I want to store the tableview header index number for each row items. I searched a lot but couldn't find out..
Waiting for the reply..
It is not clear what you need/want. If you want the current row you can do:
(check if the index is valid).
If you need to store each index in each row, so to numbering the rows, you have to work at the model level and add a column with a progressing counter. But it is very unclear to me what you need, since in the subject you state "read" and then in your post "store" the index number. What is your aim?
Tip: never flag your questions as urgent. They may be for you, but they are not for us, at least not more than the questions of your peers. If you require timely help, I suggest you hire a consultant. This is a public support channel where peers help each other without a guaranteed service level. See "here":http://catb.org/~esr/faqs/smart-questions.html#urgent for more details.
Second: if you expect any helpful response at all, you will have to be clearer in your questions. I know a thing or two about using the model view framework in Qt, but I have no idea what you mean by this question. Do you mean you are after the QModelIndex for the items in a row of a QTableView? If so, this might help you:
First step is to realize that the view is not the object you want to query for information, but the model. The view just displays the data, but the model is responsible for actually managing it. The [[doc:QAbstractItemModel]] docs mention a method index. It takes a parent item, a row and a column. You can find out the number of columns from the model as well, using columnCount. As you are working with a table, I will assume the parent item will be 0 (that is: no tree-like structures in your model). You can iterate over the column numbers to request QModelIndex objects for each of the items in a specific row.
However, note that you can not keep references to these indexes around. They may become invalid. If you want to store the indexes, you should store them in a [[doc:QPersistentModelIndex]] .
Thanks for the reply. But i actually want to get horizontalHeaderItem for QTableView?
Waiting fofr reply.
The header doesn't have indexes or items.
Well, your correct. Since I was posting this question behalf of my friend and I think i'm lacking the understanding of his requirement. Now, I've requested my friend to post directly his requirement.
Sorry for higlighting it!!!