Is there a simpler way to extract the data from a Qmodel index without referencing the standard_model instantiation
-
I have this code which works but seems clunky:
model_index_of_pn = self._standard_model.index(pn_node.row(), 0) pn = model_index_of_pn.data() model_index_of_desc = self._standard_model.index(pn_node.row(), 1) desc = model_index_of_desc.data()
I'm extracting the data for two columns on the selected row.
I think the data I need can be referenced by just using pn_node QModelIndex instantiation, but I can't seem to make it work after looking at the docs for QModelIndex
-
Hi,
Aren't you looking for QModelIndex::sibling ?
Don't forget to check for the validity of the index returned. -
You're welcome !
Since this is what you wanted, please mark the thread as solved using the "Topic Tool" button or the three dotted menu beside the answer you deem correct so that other forum users may know a solution has been found :-)