QSortFilterProxyModel not working with class inherited from QAbstractListModel
Hi,
I have one class which is inherited from QAbstractListModel which i am using as my model .. and i am creating list view from this model,, its working fine.
But when i apply QSortFilterProxyModel to it as suggested in below link .:
[URL="http://wiki.forum.nokia.com/index.php/Incremental_Search_with_Qt"]http://wiki.forum.nokia.com/index.php/Incremental_Search_with_Qt[/URL]
I am not able to filter it but when i use QStringListModel it gives me the result.. so is this a bug that QSortFilterProxyModel does not work with custom created QAbstractListModel .. plz has anyone done this before and can any one guid me on this..
Below is the code:
[CODE]lstModel = new ListModel(new FruitItem, this);
for(int i=0; i<=7;i++)
{
lstModel->appendRow(new FruitItem("Apple", i, lstModel));
lstModel->appendRow(new FruitItem("PineApple", i, lstModel));
lstModel->appendRow(new FruitItem("Grape", i, lstModel));
}
// QStringList data;
// data << "Alex" << "Bob" << "Celeste" << "David"
// << "Emil" << "Frederik" << "Gerd" << "Harald" << "Ivan";
// m_model = new QStringListModel(this);
// m_model->setStringList(data);
m_filter = new QSortFilterProxyModel(this);
m_filter->setFilterCaseSensitivity(Qt::CaseInsensitive);
m_filter->setSourceModel(lstModel);[/CODE]
Thanks