PDA

View Full Version : metadata in a QSqlQueryModel/QTableView?



gfunk
13th July 2006, 00:26
I have a QSqlQueryModel tied to a QTableView with "select lastname, firstname, ID from Account", displaying non-unique lastname and firstname columns. I want to store a special ID field/metadata to each record (similar to widget item's data roles?), so that when the user double clicks on an entry, I can just extract the ID and process it using the special ID, without making an extra query to the database. But I don't want to display the ID column. How should I do this? Maybe there are multiple ways to do this?

Thanks,

patrik08
13th July 2006, 00:40
use QTableWidget whitout sqltablemodel and save each cell to a qlist class name ....
extedet QTableWidgetItem ....
Have a look on code ..... http://www.qtforum.de/forum/viewtopic.php?t=2431 and you can browe limit next prev.....

gfunk
13th July 2006, 23:09
Hmm, I was hoping to continue using a QTableView...
I tried calling tableView->setColumnHidden() , maybe I'll use this for now...

jacek
13th July 2006, 23:13
I tried calling tableView->setColumnHidden() ,
Maybe you invoke it too early?

Another solution is a proxy model (see QAbstractProxyModel).