PathPercent QML Type

操纵路径的解释方式。更多

Import Statement: import QtQuick

属性

详细说明

通过 PathPercent,您可以调整PathView 路径上项目之间的间距。您可以用它将部分路径上的项目集中在一起,而将其他路径上的项目分散开。

下面的示例显示了项目沿路径的正态分布与将 50%的项目沿路径PathLine 部分分布的比较。

PathView {
    // ...
    Path {
        startX: 20; startY: 0
        PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 }
        PathLine { x: 150; y: 80 }
        PathQuad { x: 180; y: 0; controlX: 200; controlY: 80 }
    }
}

PathView {
    // ...
    Path {
        startX: 20; startY: 0
        PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 }
        PathPercent { value: 0.25 }
        PathLine { x: 150; y: 80 }
        PathPercent { value: 0.75 }
        PathQuad { x: 180; y: 0; controlX: 200; controlY: 80 }
        PathPercent { value: 1 }
    }
}

另请参阅 Path

属性文档

value : real

到此为止应放置的物品比例。

该值应始终高于PathPercent 在路径前一个位置指定的最后一个值。

在下面的示例中,我们有一个由三条 PathLines 组成的路径。PathView PathPercent 允许我们指定第一行和第三行各占已布局项目的 10%,而第二行占其余的 80%。

PathView {
    // ...
    Path {
        startX: 0; startY: 0
        PathLine { x:100; y: 0; }
        PathPercent { value: 0.1 }
        PathLine { x: 100; y: 100 }
        PathPercent { value: 0.9 }
        PathLine { x: 100; y: 0 }
        PathPercent { value: 1 }
    }
}

© 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.