[PyQt] How to manage multiple interdependent datamodels

Demetrius Cassidy dcassidy36 at mass.rr.com
Wed Dec 30 17:24:56 GMT 2009




Oliver Voelzel wrote:
> 
> I am writing an application, which should provide the functionality of
> SPSS (TM), a well known statistical package, in which the GUI  shows two
> table(views). One Tableview (No.1) provides adding,removing and editing
> (statistical) variables as rows, and the other one (No.2) provides
> adding/removing/editing the appropriate data (as rows), where the
> variables of view No. 1 are shown as the columns. Should I design ONE
> model, or should I work with TWO models, keeping them manually in sync. I
> considered doing this job database driven with two models and three
> database tables, but I struggled with the fact that every cell in the
> Dataview(No.2) gets its data as a result of a relational query, which
> seems to push the performance a lot? Maybe someone could give me some
> inspiration?
> 
> Best regards, Oliver
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 
> 

Having a single model simplifies things in many ways, since you don't need
to worry about keeping data in sync between two models. When you are working
with large datasets, often duplicating the data, and keeping them in sync
would be very unpractical. 

The one drawback I see would be the sorting of data. Sorting is done on the
model itself, so if you sort one table, the data in the second needs to be
refreshed too or you will end up with the visible data in one table not
matching what is in the model when you go to edit it. 

Yes you can use proxy models, but in my case this wasn't practical to do
(each table displayed different columns from the same model, and also needed
to be individually sorted).



-- 
View this message in context: http://old.nabble.com/How-to-manage-multiple-interdependent-datamodels-tp26942706p26970008.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list