@Gandalf404
I will try once again. There are two calls you can use to access data at a row/column:
If you already have a QModelIndex for the desired row/column the shortest code you can use to read the data is index.data().
If you do not have a QModelIndex but have the desired row/column in some variables you can use model.data(row, column).
If you have a desired QModelIndex index the following three expressions all return the same value:
index.model()->index(index.row(), index.column()).data()
index.model()->data(index)
index.data()
Which of these would you like to type into your code? There is nothing wrong with 1, but it is longer, and a tiny, tiny bit less efficient, than the totally equivalent 2. And similarly for 2 compared to 3. So I would choose 3.
If you do not have a QModelIndex already to hand, but you know the row and column numbers you want, you could either create a QModelIndex index(row, column) in one statement and then use one the above in the following statement or you could use approach 1 something like:
partId = model->data(someRow, 0);
kitId = model->data(someRow, 1);
partName = model->data(someRow, 2);
...
If --- and I don't know whether this is you case, but it might be --- you write a function which is passed, say, the QModelIndex index (or const QModelIndex &index) of one cell, like the partId (leftmost column 0) of some row and you wish to access the other columns in that row you might write
kitId = index.model()->index(index.row(), 1).data();
Or, if you want to shorten this one, there is also a QModelIndex QModelIndex::siblingAtColumn(int column) const method, so
kitId = index.siblingAtColumn(1).data();
None of this makes a big difference which way you write it. No matter which approach you take the code will take relatively much longer fetching the data (the actual data() call in each case) from somewhere in the model than the bit of code fiddling with index.