skuda
27th January 2009, 19:18
Hello,
i have been reading about qdatawidgetmapper and qsqltablemodel or qsqltablerelationalmodel but i am not sure any combination of them can fills my needs or if i could do in a better way.
For an example form that i would need to manage i have a customer table and an address table (because for every customer they can have > 1 addresses) so in the same form i would like to edit all the possible data of the customer.
I would like to do without using tables for the fields (well to select the address to edit i can use a table but only to populate the data in the correct widgets), QSqlTableModel or QSqlRelationalTableModel dont seems to fit very well in this scenario, am i supposed to create two different QSqlTableModel and other two different QDataWidgetMapper (one for every table implicated)?, and if i want to select the customer searching for it how could i do?, setting a filter in the two models? i am not interested in next or previous buttons and qdatawidgetmapper seems to be all about them.
It is this the best way to create database forms with qt? I am using PyQt now, i have been thinking about use SQLAlchemy to do this but i would like to go only with qt if it is possible because in the future maybe i will port the application to c++
Sorry if anything is not clear, my english is not very good :p
i have been reading about qdatawidgetmapper and qsqltablemodel or qsqltablerelationalmodel but i am not sure any combination of them can fills my needs or if i could do in a better way.
For an example form that i would need to manage i have a customer table and an address table (because for every customer they can have > 1 addresses) so in the same form i would like to edit all the possible data of the customer.
I would like to do without using tables for the fields (well to select the address to edit i can use a table but only to populate the data in the correct widgets), QSqlTableModel or QSqlRelationalTableModel dont seems to fit very well in this scenario, am i supposed to create two different QSqlTableModel and other two different QDataWidgetMapper (one for every table implicated)?, and if i want to select the customer searching for it how could i do?, setting a filter in the two models? i am not interested in next or previous buttons and qdatawidgetmapper seems to be all about them.
It is this the best way to create database forms with qt? I am using PyQt now, i have been thinking about use SQLAlchemy to do this but i would like to go only with qt if it is possible because in the future maybe i will port the application to c++
Sorry if anything is not clear, my english is not very good :p