[Qt-interest] Get mapped value from a QSqlRelationalTableModel
Linos
info at linos.es
Mon May 16 12:04:51 CEST 2011
Hi,
use Qt::EditRole in .data method.
Regards,
Miguel Angel.
El 16/05/11 03:46, Petric Frank escribió:
> 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
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list