[Qt-interest] QCompleter with QAbstractTableModel or QSortFilterProxyModel ?

Till Priemer till.priemer at kerdos.de
Thu Sep 9 17:39:42 CEST 2010


Hello,

I use QCompleter with QAbstractListModel in QLineEdit. Works fine. Now I
want to reduce the Number of Items dynamically in the model seen by the
QCompleter based on additional attributes (e.g. I have a list of names as
QStringListModel but now I want to use the male ones within the completer
only). My Idea was to use a QTableModel instead of QStringModel and store
the name in the first column and the other attributes (gender, age, ...) in
the following columns. Then I use a QSortFilterProxyModel for filtering the
attribute I want. The QCompleter gets the proxyModel as model(). 
But the documentation of QCompleter says the only models allowed are list-
and tree-models !?

why isn't it possible to use QSortFilterProxyModel?


Till




More information about the Qt-interest-old mailing list