Insert column in a QTableView
-
wrote on 6 May 2015, 15:57 last edited by Robey Mardon 5 Jun 2015, 18:23
I'm using
QSqlTableModel
along withQTableView
and the model returns the columns and rows, for example:name
,brand
, how to insert a custom column between them onQTableView
? For example:name
,model
,brand
.Let me explain it better... only
name
andbrand
is within the database, themodel
is a custom column that I need to add between them, and it doesn't need to be saved on the database, because the value can alter in runtime. -
Hi,
You need a proxy model. Have a look a QAbstractProxyModel and QSortFilterProxyModel
-
wrote on 3 Feb 2016, 12:49 last edited by
I wrote such a proxy (generic insertion of extra columns). You can use it, assuming LGPL code is OK: