Qt 4.8
PathAttribute Class Reference

The PathAttribute allows setting an attribute at a given position in a Path. More...

Detailed Description

The PathAttribute allows setting an attribute at a given position in a Path.

Since
4.7

The PathAttribute object allows attributes consisting of a name and a value to be specified for various points along a path. The attributes are exposed to the delegate as Attached Properties. The value of an attribute at any particular point along the path is interpolated from the PathAttributes bounding that point.

The example below shows a path with the items scaled to 30% with opacity 50% at the top of the path and scaled 100% with opacity 100% at the bottom. Note the use of the PathView.iconScale and PathView.iconOpacity attached properties to set the scale and opacity of the delegate.

declarative-pathattribute.png
import QtQuick 1.0
Rectangle {
width: 240; height: 200
//! [1]
Component {
id: delegate
Item {
width: 80; height: 80
scale: PathView.iconScale
opacity: PathView.iconOpacity
Column {
Image { anchors.horizontalCenter: nameText.horizontalCenter; width: 64; height: 64; source: icon }
Text { id: nameText; text: name; font.pointSize: 16 }
}
}
}
//! [1]
//! [2]
PathView {
anchors.fill: parent
model: ContactModel {}
delegate: delegate
path: Path {
startX: 120; startY: 100
PathAttribute { name: "iconScale"; value: 1.0 }
PathAttribute { name: "iconOpacity"; value: 1.0 }
PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 }
PathAttribute { name: "iconScale"; value: 0.3 }
PathAttribute { name: "iconOpacity"; value: 0.5 }
PathQuad { x: 120; y: 100; controlX: -20; controlY: 75 }
}
}
//! [2]
}
(see the PathView documentation for the specification of ContactModel.qml used for ContactModel above.)
See also
Path

The documentation for this class was generated from the following file: