[Qt-interest] How to implement a "proxy model" based on QSqlQueryModel
Andreas Ntaflos
daff at pseudoterminal.org
Fri Dec 19 20:44:26 CET 2008
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2485 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20081219/6bf1bf82/attachment.bin
More information about the Qt-interest-old
mailing list