qt-interest@trolltech.com
[Top] [All Lists]

[Qt-interest] How to implement a "proxy model" based on QSqlQueryModel

Subject: [Qt-interest] How to implement a "proxy model" based on QSqlQueryModel
From: Andreas Ntaflos
Date: Fri, 19 Dec 2008 20:44:26 +0100
Hello list, 

What I want to do: a QComboBox should present the user a number of items from 
a database (a single column of a single table in this case) as well as an 
additional item not in the database. This is part of a search widget that 
allows the user to select various items to search for or to not constrain the 
search criteria by selecting the additional "Any" item not found in the 
database.

In #qt I was told to create a custom proxy model that takes the items from a  
QSqlQueryModel (the items in the database) and adds the additional "Any" 
item. The QComboBox is then set to this proxy model and all would be well :)

My question: how do I do this? Do I need to subclass QSqlQueryModel? Or do I 
need to encapsulate a QSqlQueryModel? What are the general steps I have to 
take here? Pointers to a good FM that I could R are most welcome.

Or is there a simpler way to accomplish this?

Thanks in advance!

Andreas
-- 
Andreas Ntaflos 
Vienna, Austria 

GPG Fingerprint: 6234 2E8E 5C81 C6CB E5EC  7E65 397C E2A8 090C A9B4
_______________________________________________
Qt-interest mailing list
Qt-interest@xxxxxxxxxxxxx
http://lists.trolltech.com/mailman/listinfo/qt-interest
<Prev in Thread] Current Thread [Next in Thread>
  • [Qt-interest] How to implement a "proxy model" based on QSqlQueryModel, Andreas Ntaflos <=