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 <[email protected]> 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
> [email protected]
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>
>
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to