i92guboj
20th August 2013, 11:39
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:
setQuery("SELECT fam,ref,desc,cant,pvp,incr,sub FROM presupuestados_cascos_y_accesorios WHERE presupuesto=? UNION "
"SELECT fam,ref,desc,cant,pvp,incr,sub FROM presupuestados_complementos WHERE presupuesto=? UNION "
"SELECT fam,ref,desc,cant,pvp,incr,sub FROM presupuestados_puertas_y_cajones WHERE presupuesto=? UNION "
"SELECT fam,ref,desc,cant,pvp,incr,sub FROM presupuestados_electrodomesticos WHERE presupuesto=?;");
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 :)
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:
setQuery("SELECT fam,ref,desc,cant,pvp,incr,sub FROM presupuestados_cascos_y_accesorios WHERE presupuesto=? UNION "
"SELECT fam,ref,desc,cant,pvp,incr,sub FROM presupuestados_complementos WHERE presupuesto=? UNION "
"SELECT fam,ref,desc,cant,pvp,incr,sub FROM presupuestados_puertas_y_cajones WHERE presupuesto=? UNION "
"SELECT fam,ref,desc,cant,pvp,incr,sub FROM presupuestados_electrodomesticos WHERE presupuesto=?;");
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 :)