Home · All Classes · All Functions · Overviews

QML VisualItemModel Element Reference

The VisualItemModel allows items to be provided to a view. More...

Properties

Detailed Description

The children of the VisualItemModel are provided in a model which can be used in a view. Note that no delegate should be provided to a view since the VisualItemModel contains the visual delegate (items).

An item can determine its index within the model via the VisualItemModel.index attached property.

The example below places three colored rectangles in a ListView.

 Item {
     VisualItemModel {
         id: itemModel
         Rectangle { height: 30; width: 80; color: "red" }
         Rectangle { height: 30; width: 80; color: "green" }
         Rectangle { height: 30; width: 80; color: "blue" }
     }

     ListView {
         anchors.fill: parent
         model: itemModel
     }
 }

Property Documentation

count : int

The number of items in the model. This property is readonly.



Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt 4.7.0