Creating a QLineEdit search field for items displayed in a QListView
- by krunk
I want to create a search field that filters the items shown in a QListView. Basically the user could type in "foo" and only items with "foo" in the DisplayRole are shown.
I already have a few ideas on how to do this, but thought I'd ask those more experienced than I.
My idea would be to use some signals and slots to set a filter in the QAbstractItem model and trigger an update() in the QListView.
Are there any helper methods in QListView for filtering I may have missed?
Is there a canonical way of handling this I haven't run across?