Left join on to models
I have search on a lot of qt sites/forums. But i can not find the solution how to to join 2 QSqlTableModels together.
The models x and y can an be joined on x.nr and y.nr. table y contains extra information so i want to use a Left join. If the is for some reason no extra information the row form x is still displayed. The result needs to be a models so i can view it with a QTableView.
On several places i read that i need to subclass QAbstractProxyModel. But how? which function need to be reimplemented?
Does someone has an example?
Can mentioned join be achieved by sql query? If yes then instead of implementing filtering model (QAbstractProxyModel) try to set appropriate sql query for your QSqlTableModel (see 'setQuery' methods).
Model x is a model with data that is not committed to the database. So a join in the database cant be done. Table y contains extra information for each row from table x.