[Solved]QSortFilterProxyModel dont find in the “folder”
Hellow!
I use this code:
- searchModel.setSourceModel(itemModel);
- {
- if(str.isEmpty())
- {
- dataTreeView->setModel(itemModel);
- return;
- }
- searchModel.setFilterWildcard(str);
- dataTreeView->setModel(&searchModel);
- }
But my sort model dont find items in “folders”, it find only items which have not parents
For example:
This is my program with all item in my item model

And it is my program with QSortFilterProxyModel

How can i do that my sort model find all items?
And other question:
How can i do that my QSortFilterProxyModel find items in all columns simultaneously?
In advance many thank for your help!
5 replies
Hi,
Did you try
?
filterKeyColumn : int
This property holds the column where the key used to filter the contents of the source model is read from.
The default value is 0. If the value is -1, the keys will be read from all columns.
By default it is only searching in the column 0
- {
- if(str.isEmpty())
- {
- dataTreeView->setModel(itemModel);
- return;
- }
- searchModel.setFilterWildcard(str);
- searchModel.setFilterKeyColumn(-1); /*this solves*/
- dataTreeView->setModel(&searchModel);
- }
I wrote a proxy you might use as inspiration. Depending on the size of your model, it might need serious performance enhancements, but it is a start. Check this [developer.qt.nokia.com] topic for details.
I wrote a proxy you might use as inspiration. Depending on the size of your model, it might need serious performance enhancements, but it is a start. Check this [developer.qt.nokia.com] topic for details.
Great information.
Thanks.
You must log in to post a reply. Not a member yet? Register here!


