
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
ThePathAttribute allows setting an attribute at a given position in a Path.More...
| Since: | Qt 4.7 |
ThePathAttribute 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 asAttached 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 thePathView.iconScale andPathView.iconOpacity attached properties to set the scale and opacity of the delegate.
| import QtQuick 1.0Rectangle {width:240;height:200Component {id:delegateItem {width:80;height:80scale:PathView.iconScaleopacity:PathView.iconOpacityColumn {Image {anchors.horizontalCenter:nameText.horizontalCenter;width:64;height:64;source:icon }Text {id:nameText;text:name;font.pointSize:16 } } } }PathView {anchors.fill:parentmodel:ContactModel {}delegate:delegatepath:Path {startX:120;startY:100PathAttribute {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 thePathView documentation for the specification of ContactModel.qml used for ContactModel above.) |
See alsoPath.
This property holds the name of the attribute to change.
This attribute will be available to the delegate asPathView.<name>
Note that using an existing Item property name such as "opacity" as an attribute is allowed. This is because path attributes add a newAttached Property which in no way clashes with existing properties.
This property holds the value for the attribute.
The value specified can be used to influence the visual appearance of an item along the path. For example, the following Path specifies an attribute nameditemRotation, which has the value0 at the beginning of the path, and the value 90 at the end of the path.
Path {startX:0startY:0PathAttribute {name:"itemRotation";value:0 }PathLine {x:100;y:100 }PathAttribute {name:"itemRotation";value:90 }}
In our delegate, we can then bind therotation property to theAttached PropertyPathView.itemRotation created for this attribute.
Rectangle {width:10;height:10rotation:PathView.itemRotation}
As each item is positioned along the path, it will be rotated accordingly: an item at the beginning of the path with be not be rotated, an item at the end of the path will be rotated 90 degrees, and an item mid-way along the path will be rotated 45 degrees.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.