Home · All Classes · All Functions · Overviews

QML PathView Element Reference

[Inherits Item]

The PathView element lays out model-provided items on a path. More...

Properties

Attached Properties

Detailed Description

The model is typically provided by a QAbstractListModel "C++ model object", but can also be created directly in QML.

The items are laid out along a path defined by a Path and may be flicked to scroll.

     Component {
         id: delegate
         Item {
             id: wrapper
             width: 80; height: 80
             Column {
                 Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon }
                 Text { id: name; text: name; font.pointSize: 16}
             }
         }
     }
     PathView {
         anchors.fill: parent; model: MenuModel; delegate: delegate
         path: Path {
             startX: 120; startY: 100
             PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 }
             PathQuad { x: 120; y: 100; controlX: -20; controlY: 75 }
         }
     }

See also Path.


Property Documentation

count : int

This property holds the number of items in the model.


currentIndex : int

This property holds the index of the current item.


delegate : component

The delegate provides a template defining each item instantiated by the view. The index is exposed as an accessible index property. Properties of the model are also available depending upon the type of Data Model.

Note that the PathView will layout the items based on the size of the root item in the delegate.

Here is an example delegate:

     Component {
         id: delegate
         Item {
             id: wrapper
             width: 80; height: 80
             Column {
                 Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon }
                 Text { id: name; text: name; font.pointSize: 16}
             }
         }
     }

dragMargin : real

This property holds the maximum distance from the path that initiate mouse dragging.

By default the path can only be dragged by clicking on an item. If dragMargin is greater than zero, a drag can be initiated by clicking within dragMargin pixels of the path.


model : model

This property holds the model providing data for the view.

The model provides a set of data that is used to create the items for the view. For large or dynamic datasets the model is usually provided by a C++ model object. Models can also be created directly in XML, using the ListModel element.

See also Data Models.


offset : real

The offset specifies how far along the path the items are from their initial positions.


path : Path
default

This property holds the path used to lay out the items. For more information see the Path documentation.


pathItemCount : int

This property holds the number of items visible on the path at any one time


snapPosition : real

This property determines the position (0-100) the nearest item will snap to.


Attached Property Documentation

PathView.onPath : bool

This attached property holds whether the item is currently on the path.

If a pathItemCount has been set, it is possible that some items may be instantiated, but not considered to be currently on the path. Usually, these items would be set invisible, for example:

 Component {
     Rectangle {
         visible: PathView.onPath
         ...
     }
 }

It is attached to each instance of the delegate.



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