Hello.

I am trying to subclass an editable QSqlQueryModel.

The thing would be simple enough, even for me, if it wasn't because I am taking data from many tables, using a query like this one:

Qt Code:
  1. setQuery("SELECT fam,ref,desc,cant,pvp,incr,sub FROM presupuestados_cascos_y_accesorios WHERE presupuesto=? UNION "
  2. "SELECT fam,ref,desc,cant,pvp,incr,sub FROM presupuestados_complementos WHERE presupuesto=? UNION "
  3. "SELECT fam,ref,desc,cant,pvp,incr,sub FROM presupuestados_puertas_y_cajones WHERE presupuesto=? UNION "
  4. "SELECT fam,ref,desc,cant,pvp,incr,sub FROM presupuestados_electrodomesticos WHERE presupuesto=?;");
To copy to clipboard, switch view to plain text mode 

So, when it came the time to reimplement QSqlQueryModel::setData() I realized that, for this to be doable, I would need a way to know from which table a given row/record came from.

What I want to ask is: is there any way to reference the table a given row came from using the model? Or should I just resort to something hackish like querying all my tables for matches?

Thank you beforehand for any insight