Adding columns to a proxy model without affecting the source model
Solved
General and Desktop
-
I have a QSqlTableModel being shown in a QTableView with a QSortFilterProxyModel derived class between them.
I want my view to display a calculated column, so I add this column to the proxy model and have the data() function calculate the value. Unfortunately inserting a column to the proxy model also adds the new column to my QSqlTableModel. This throws the updates of my QSqlTableModel askew.
Is there an existing model which will allow me to add a column to it while leaving the source model alone or is this something I have to craft? If I have to create this, is there a place to post such things for others to use?
Mike
-
The KDE API (works on every platform supported by Qt) has what you need KExtraColumnsProxyModel