[Qt-interest] Searchable list widget
Sonic
get.sonic at gmail.com
Mon Feb 15 16:20:54 CET 2010
On 02/14/2010 06:20 PM, Axel Jäger wrote:
> Just use a QStringListModel or QStandardItemModel
>
> The widget based approach does not scale. You should stop using it sooner than later.
>
Thanks for all the help. Here's what I did:
1. Inherited from QStandardItem to support a carrying custom payload
2. Created a QStandardModel and added items to it
3. Created a QSortFilterProxyModel and used it as you suggested
4. Added an event filter for the search text box to pass on key-board
navigation (up/down/enter etc.) events to the list box
Everything's fine, except for one doubt. I add new items to the list by
doing:
MyItemClass *item = new MyItemClass;
model->addRow(0, item);
How do I make sure that these dynamically allocated item objects are
deleted? Deleting the model or the view object doesn't seem to delete
the item objects. Any idea?
thanks and regards,
Syam
More information about the Qt-interest-old
mailing list