PathAttribute QML Type

경로의 지정된 위치에 속성을 설정하는 방법을 지정합니다. 더 보기...

Import Statement: import QtQuick

속성

상세 설명

PathAttribute 객체를 사용하면 경로의 다양한 지점에 대해 이름과 값으로 구성된 속성을 지정할 수 있습니다. 속성은 델리게이트에게 첨부된 속성으로 노출됩니다. 경로를 따라 특정 지점에 있는 속성의 값은 해당 지점을 경계로 하는 PathAttributes에서 보간됩니다.

아래 예는 항목의 크기가 30%로 조정되고 경로 상단의 불투명도 50%, 하단의 불투명도 100%로 조정된 경로를 보여줍니다. 델리게이트의 스케일과 불투명도를 설정하려면 PathView.iconScale 및 PathView.iconOpacity 첨부 속성을 사용하세요.

import QtQuick

Rectangle {
    width: 240; height: 200

    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 }
            }
        }
    }

    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 }
        }
    }
}

(위의 ContactModel에 사용된 ContactModel.qml의 사양은 PathView 문서를 참조하세요.)

Path도 참조하세요 .

속성 문서

name : string

이 속성에는 변경할 속성의 이름이 저장됩니다.

이 속성은 델리게이트가 PathView.<이름>으로 사용할 수 있습니다.

"불투명도"와 같은 기존 항목 속성 이름을 속성으로 사용할 수 있습니다. 이는 경로 속성이 기존 속성과 충돌하지 않는 새 첨부 속성을 추가하기 때문입니다.


value : real

이 속성은 속성 값을 보유합니다.

지정된 값은 경로를 따라 항목의 시각적 모양에 영향을 주는 데 사용할 수 있습니다. 예를 들어, 다음 Path는 경로의 시작 부분에 값이 0이고 경로의 끝에 값이 90인 itemRotation이라는 속성을 지정합니다.

Path {
    startX: 0
    startY: 0
    PathAttribute { name: "itemRotation"; value: 0 }
    PathLine { x: 100; y: 100 }
    PathAttribute { name: "itemRotation"; value: 90 }
}

그런 다음 델리게이트에서 회전 속성을 이 속성에 대해 생성된 첨부 프로퍼티 PathView.itemRotation에 바인딩할 수 있습니다.

Rectangle {
    width: 10; height: 10
    rotation: PathView.itemRotation
}

각 항목이 경로를 따라 배치되면 그에 따라 회전됩니다. 경로의 시작 부분에 있는 항목은 회전되지 않고, 경로의 끝에 있는 항목은 90도 회전되며, 경로의 중간에 있는 항목은 45도 회전됩니다.


© 2025 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 the GNU 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.