[solved]ProxyModel not working
-
I've inherited QSortFilterProxyModel creating class MyProxyModel
in this class I rewrite data() method to show something different on column 4.
@
MyProxyModel *pmod = new MyProxyModel(this);
pmod->setSourceModel(mod);
ui->tblOre->setModel(pmod);
fprintf(stderr,"%d\n",ui->tblOre->model()->data(pmod->index(1,4)).toInt());
fprintf(stderr,"%d\n",pmod->data(pmod->index(1,4)).toInt());
@I don't know why those printf have different outputs:
the first uses the real data in the underlying model
the second shows the data I want(ui->tblOre->model()==pmod) returns true
obviusly the problem is that when I use the view to show data, in the column I need to show particular data, real data is shown.
-
Well, can you paste your implementation of data()?
-
solved by myself...
the problem was that I've omitted the const in the data() function signature, so superclass method was called.
thanks anyway