The PathAttribute allows setting an attribute at a given position in a Path. More...
The PathAttribute object allows attibutes consisting of a name and a value to be specified for the endpoints of path segments. The attributes are exposed to the delegate as Attached Properties. The value of an attribute at any particular point is interpolated from the PathAttributes bounding the 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.scale and PathView.opacity attached properties to set the scale and opacity of the delegate.
import Qt 4.7 Rectangle { width: 240; height: 200 Component { id: delegate Item { width: 80; height: 80 scale: PathView.iconScale opacity: PathView.iconOpacity Column { Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon } Text { text: name; font.pointSize: 16} } } } 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 } } } } |
See also Path.
name : string |
the name of the attribute to change.
This attribute will be available to the delegate as PathView.<name>
Note that using an existing Item property name such as "opacity" as an attribute is allowed. This is because path attributes add a new Attached Property which in no way clashes with existing properties.
value : string |
the new value of the attribute.