[Qt-qml] Disable an item in QAbstractListModel so it doesn't show up in a ListView
vineeth
nvineeth at gmail.com
Thu Jun 23 08:45:19 CEST 2011
How about this :
Assuming there is a quantity field in the model,
In the delegate add,
visible: model.quantity !=0
--vineeth
On Wed, Jun 22, 2011 at 10:32 PM, Matt Barclay <mbarclay at gmail.com> wrote:
> 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
>
>
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110623/43cb5c6b/attachment.html
More information about the Qt-qml
mailing list