Hi All-

I am new to Qt 4 (I have used Qt 3 for sometime however), and I am trying to get a handle on the use of the model/view architecture. Specifically, the data that will ultimately populate the model is hierarchal in nature and I plan on having two separate views: one a QTreeView and the other a QTableView that will just show the leaves of the tree. I am assuming that I will need to implement a proxymodel in order to mask a tabular model on top of the hierarchical model and translate indices between the two types of views.

Working under that assumption, I have been trying to learn the ins and outs of how a proxymodel and a model are supposed to interact with one another. Using Qt's sortingmodel example - found in QTDIR/examples/itemviews/sortingmodel/main.cpp - as a starting point, I have been trying to figure out how one is supposed to share a selection between the two views. Therefore, I have made the following change to that aforementioned main.cpp file:

----------------------------------------------------------------------------------------------
sortedView.header()->setClickable(true);

sortedView.setSelectionModel(unsortedView.selectio nModel()); // line added

sortedView.show();
----------------------------------------------------------------------------------------------

As may come to no surprise to some of you, this didn't work. I know that I should be using mapSelectionToSource and/or mapSelectionFromSource somewhere, but I'm not sure where. Should I re-implement QTreeView in order to tell the object that its referenced model is a proxymodel? That doesn't seem right. I would assume that since the QSortFilterProxyModel was developed by Trolltech, that it already has the important code where its needed, so that's doesn't seem right either. Should I make a change to the TreeModel referenced in the example? Any thoughts on how to get going here?

Thank you for your time!