Itemview (ProxyModel)
-
Is this possible can I ask my proxymodel to give my view only child elements of given parent index.
I have two view, mytreeview->setModel(originalModel) other view is myTableview->setModel(proxyModel), proxyModel->setSourceModel(originalModel).
Now some how I want my proxy model to give me only data of child items , is this possible at all ? is there any way I can give parentIndex to my proxy ??
-
You can build a proxy model that does that, but none of the standard proxy models work that way. There is no standard functionality to do this.
However, you can also use the view to do the work for you. Just set the correct modelIndex as the root index for the table view. If you want to display only children of the currently selected item in the tree view, you get that item's model index, map it to the corresponding index in the proxy (using one of the proxy model mapping methods), and set the resulting index as the root index for your table view.