Suppose I have a class Client (subclassing sqlalchemy.ext.declarative.declarative_base), giving me an SQL table of clients. Each client has
- a name,
- a number and
- an image path.
(Of course there are more variables in real)
What I want, is a vertical list of panels in my GUI, where each panel includes the client's image, name and number. The panel should
- be clickable and
- show an optical response OnMouseOver.
Further, the list of these items should allow to be
- reordered (e.g. by number, surname, ...) and
- filtered (e.g. by surnames starting with "A").
Of course everything should be as efficient as possible :)
Implementation
In the past, I tried to do it very naively, using a QWidget with QVBoxLayout, adding each of the panels (subclass of QFrame) using addWidget(). When I applied a filter, I removed all the panels and added the filtered ones again in the desired order. Of course, this cannot be the best solution, since it is very inefficient and difficult to update, etc.
I guess, using a QListView with an underlying QAbstractListModel would be much better. Or maybe even QAbstractItemView/QAbstractItemModel?
Could anyone push me to the right direction and give some comments/suggestions on how to optimally implement the described behavior? I would be grateful!