Creating a QLineEdit search field for items displayed in a QListView
Posted
by krunk
on Stack Overflow
See other posts from Stack Overflow
or by krunk
Published on 2010-04-23T02:48:24Z
Indexed on
2010/04/23
2:53 UTC
Read the original article
Hit count: 348
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?
© Stack Overflow or respective owner