PathRectangle QML Type
定义带圆角的矩形。更多
Import Statement: | import QtQuick |
Since: | QtQuick 6.8 |
属性
- bottomLeftRadius : real
- bottomRightRadius : real
- height : real
- radius : real
- relativeX : real
- relativeY : real
- strokeAdjustment : real
- topLeftRadius : real
- topRightRadius : real
- width : real
- x : real
- y : real
详细说明
PathRectangle 提供了一种指定矩形(可选圆角)的简便方法。其 API 与Rectangle 项目的 API 相对应。
另请参见 Path,PathLine,PathQuad,PathCubic,PathArc,PathAngleArc,PathCurve 和PathSvg 。
属性文档
radius : real |
该属性定义用于定义圆角矩形的角半径。
如果半径为正值,矩形路径将被定义为圆角矩形,否则将被定义为普通矩形。
该属性可以被各个边角半径属性覆盖。
另请参阅 topLeftRadius,topRightRadius,bottomLeftRadius, 和bottomRightRadius 。
strokeAdjustment : real |
该属性定义了对矩形坐标的描边宽度调整。
在启用了描边功能的ShapePath 中使用时,实际描边的矩形默认情况下会超出定义的矩形,四边的宽度为描边宽度的一半。这是预期的行为,因为路径定义了描边的中点线,并对应于QPainter 和 SVG 渲染。
如果希望定义的矩形是描边矩形的外边缘,就像带有边框的Rectangle 项目一样,可以将 strokeAdjustment 设置为描边宽度。这将有效地将所有边缘向内移动一半的描边宽度。例如下面的示例:
ShapePath { id: myRec fillColor: "white" strokeColor: "black" strokeWidth: 16 joinStyle: ShapePath.MiterJoin PathRectangle { x: 10; y: 10; width: 200; height: 100; strokeAdjustment: myRec.strokeWidth } }
© 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.