[Qt-interest] Get mapped value from a QSqlRelationalTableModel
Petric Frank
pfrank at gmx.de
Mon May 16 03:46:23 CEST 2011
Hello,
i use a QSqlRelationalTableModel instance. It ha a mapped field into an into an
other table. I used a QSqlRelation to do that.
This is ok for most cases, but sometimes i want to obtain the mapped value
instead of the replaced one.
How to get the original value ?
Little code snippet:
---------------------- cut ---------------------
QSqlRelationalModel relmodel (...);
relmodel.setTable ("source");
relmodel.setRelation (2, QSqlRelation ("maptable", "mapindex", "mapvalue");
...
QVariant value (relmodel.data (relmodel.index (7, 2));
---------------------- cut ---------------------
Using the last statement i get the value mapped to the one of table "maptable"
taken from column "mapvalue".
What want is to get the original value from table "source" column number 2.
Of course i want to keep the mapping, because i need it also.
Any hints ?
regards
Petric
More information about the Qt-interest-old
mailing list