The VisualItemModel allows items to be provided to a view. More...
This element was introduced in Qt 4.7.
A VisualItemModel contains the visual items to be used in a view. When a VisualItemModel is used in a view, the view does not require a delegate since the VisualItemModel already contains the visual delegate (items).
An item can determine its index within the model via the index attached property.
The example below places three colored rectangles in a ListView.
import QtQuick 1.0 Rectangle { 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 } }
See also VisualItemModel example.
read-onlycount : int |
The number of items in the model. This property is readonly.
read-onlyVisualItemModel.index : int |
This attached property holds the index of this delegate's item within the model.
It is attached to each instance of the delegate.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.