Quote Originally Posted by d_stranz View Post
If the original model is a table model (QSqlQueryModel derives from QAbstractTableModel), then how can you display that in a QTreeView without using a proxy model that maps the table into a tree?
I wouldn't use QSqlQueryModel in such a case. As you said it is a table model.
Since it is just a convenience wrapper to present the result of an SQL query in a table, it is just doing things that are not needed here.


Quote Originally Posted by d_stranz View Post
Converting the table into QStandardItemModel or any other type of model basically requires turning it into a tree, so why not use a tree-shaped proxy model?
You can, of course, use a proxy for that, but why go through the complexity of a proxy when you can present the data in the way you want to in the first place.

Quote Originally Posted by d_stranz View Post
The disadvantage of using a separate model is that if you want to display the QSqlQueryModel as both a table and a tree, you lose the connection between selections in the tree and table views because the models are independent. With a proxy that uses the original QSqlQueryModel as source, the mapping of selections is easier.
You would still have to synchronize the two selection models since the two views are working with different models.

Cheers,
_