[Qt-interest] Templated QAbstractItemModel storing QObjects

slayer81 at gmx.de slayer81 at gmx.de
Sun Jul 25 16:29:22 CEST 2010


Hello!

Currently I use a QListView connected to a QSqlQueryModel to display an overview of database entries in a list UI. While the database object consist of several columns, my QSqlQueryModel returns a single column (e.g. 
"name" concatenated with an second property).
This works well so far.

Now I'd like to switch my model from a list of QString objects to a list of real QObjects (database entities handled by the ORM QDjango). Working on full entities makes things easier for me. I guess a QItemDelegate could define 
the way the objects are displayed in views like QListView, so displaying only one column of the whole object should be possible.

I'm not quite sure yet which way to go, because I'd like to use a templated type, making a call to the model retrieve the casted type instead of just an QObject.

Can anyone give suggestions how to handle this case?

Thank you!

Paule






More information about the Qt-interest-old mailing list