[Qt-qml] Disable an item in QAbstractListModel so it doesn't show up in a ListView
Matt Barclay
mbarclay at gmail.com
Wed Jun 22 19:02:29 CEST 2011
Hello,
I have a C++ model derived from QAbstractListModel. I want to disable
certain elements of the model so they don't get a delegate in the ListView.
i.e. I want them hidden from the listview. These elements can also be
enabled under certain conditions. Think if it like an inventory system
where the item is not displayed with quantity equals 0, but as soon as
quanity > 0 the item reappears in the ListView.
I tried using overriding QAbstractListModel::flags(index) and
returning *QAbstractListModel::flags(index)
& ~Qt::ItemIsEnabled;* But that isn't the same thing as removing the item
from the view.
Is this possible? I really want to avoid removing the item from the model,
since visibility is a property of the item.
Thanks,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110622/dd984186/attachment.html
More information about the Qt-qml
mailing list