That is not really hard.
(Except that you now have two models with their own indexes. Thus you have now the possibility to use an index of model A with model B which would be not good at all. Just remember that an index you get (usually from a view's signals) is an index of that view's model. If you use a proxy, it is therefore an index of the proxy model. You have to map the index back to the source model with QSortFilterProxyModel::mapToSource() or, if possible, avoid the danger by writing
// tv being a QTreeView* and idx an index 'signaled' by it
tv->model()->data(idx);
idx.data()
// rather than
myModel.data(idx); // with myModel being your (proxy's source) model
// This second approach is unhappy if you introduce proxies (you could layer those...) later on.
// tv being a QTreeView* and idx an index 'signaled' by it
tv->model()->data(idx);
idx.data()
// rather than
myModel.data(idx); // with myModel being your (proxy's source) model
// This second approach is unhappy if you introduce proxies (you could layer those...) later on.
To copy to clipboard, switch view to plain text mode
)
Hope this gets you going.
Bookmarks