[Qt-interest] How to retreive a value in relational sql model?

Yevgen Yashchenko lester.dev at gmail.com
Wed Dec 2 11:17:31 CET 2009


Hi, I have a QSqlRelationalTableModel with a column used as a foreign key in
another table.
Let's say the tables are like this:

Table1: id, name_id
Table2: id, name

so table1.name_id is mapped as QSqlRelation to table2.name with an index set
to table2.id.

What I need is to retrieve that name_id in the delegate attached to table1
view to make some additional computations.
In delegate I have 'index' so I can use it to get the value from the model,
but the model->data() returns me a mapped value
from the table2.name what I don't need at the moment. Is there any way to
get that table1.name_id without a subclassing model
without those jerky qhashes and maps?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091202/df9a8ba2/attachment.html 


More information about the Qt-interest-old mailing list