I have a Qt C++ application to which I'd like to add a list of "Card" objects. Each Card can contain a few widgets, including a text area and two spinboxes. Here's the hard part: I want to be able to sort and filter this list dynamically. I tried making a QListView with a StandardItemModel, and set a SortFilterProxyModel on the StandardItemModel. This works fine when the items in the model (which must be QStandardItem) only contain text. The problem is that I can't add a Widget, such as a SpinBox, to a QStandardItem.

I tried subclassing QStandardItem, but I could not figure out how to display Widgets in my subclass. I tried the QStyledItemDelegate example of a custom spinbox (https://doc.qt.io/qt-5/qtwidgets-ite...e-example.html), but this only works for rendering a single spinbox: it doesn't let me add any Widget to my QStandardItem.

Is there a way to display a list of Widgets or Widget containers, such that I can filter and sort the list? My goal here is to make a list of card-like items (as described here: https://material.io/components/cards/#anatomy), and to show, hide, and sort the cards.