PDA

View Full Version : How to get the index of original SQL table?



Kode.Cooper
27th January 2010, 09:43
hi there,
I have 2 tables here.


Table 1 : ID, typeID, name, other feilds...
Table 2 : typeID, typeName


Now, I have a QTableView which show the contents of typeID, name,
and another QWidget which display the detail information. It's very same with the Qt Demo Program Books .

I use QSqlRelationalTableModel as the model. and create the relation between Table 1 and 2.


// Set the relations to the other database tables
m_model->setRelation( mTypeIdx, QSqlRelation( "types", "id", "name" ) );


You know after I did this, QTableView would not disaplay the typeID, It replaced by typename.
How can I display the typeID rather the typename in QTableView ?
I digged the whole forum, without any tips.

Thanks.