本页内容

gridpattern2d QML Value Type

提供与 `QCanvasGridPattern` 匹配的 `gridpattern2d` 类型。更多内容...

Import Statement: import QtCanvas2D
Since: Qt 6.12
Status: Technology preview

该类型处于技术预览阶段,可能会有变动。

方法

详细说明

此值类型由QtCanvas2D 导入提供。

另请参阅 QCanvasGridPattern 。

方法文档

color backgroundColor()

返回图案网格的背景色。

另请参阅 ` setBackgroundColor()`。

size cellSize()

返回网格中单个单元格的大小。

另请参阅 ` setCellSize()`。

real feather()

返回以像素为单位的羽毛图案。

另请参阅 setFeather()。

color lineColor()

返回图案网格线的颜色。

另请参阅 setLineColor()。

real lineWidth()

返回网格图案中线条的宽度。

另请参阅 ` setLineWidth()`。

real rotation()

返回图案的旋转角度(单位为弧度)。

另请参阅 setRotation()。

void setBackgroundColor(color backgroundColor)

将图案网格的背景色设置为backgroundColor 。默认值为黑色。

另请参阅 backgroundColor()。

void setCellSize(real width, real height)

将网格模式下单个单元格的大小设置为width 、height 。当 width 为0 时,不会绘制水平分隔线。当 height 为0 时,不会绘制垂直分隔线。默认值为(10, 10) 。

另请参阅 cellSize()。

void setCellSize(size cellSize)

将网格模式下单个单元格的大小设置为cellSize 。当width为0 时,不会绘制水平条;当height为0 时,不会绘制垂直条。默认值为(10, 10) 。

这是一个重载函数。

void setFeather(real feather)

将图案羽化设置为feather (单位为像素)。默认值为1.0 ,表示单像素抗锯齿。

另请参阅 feather()。

void setLineColor(color lineColor)

将图案网格线的颜色设置为lineColor 。默认值为白色。

另请参阅 lineColor()。

void setLineWidth(real width)

将网格图案中线条的宽度设置为width 。默认值为1.0 。

另请参阅 lineWidth()。

void setRotation(real rotation)

将图案旋转设置为rotation (单位为弧度)。旋转以网格startPosition()为中心进行。默认值为0.0 ,表示网格不进行旋转。

另请参阅 rotation()。

void setStartPosition(real x, real y)

将网格图案的起始点设置为 (x,y)。起始位置指图案中网格的左上角。随后,图案将从该位置向所有方向延伸。默认值为(0.0, 0.0) 。

另请参阅 startPosition()。

void setStartPosition(point start)

将网格图案的起始点设置为start 。起始位置指图案中网格的左上角。随后,图案将从该位置向所有方向延伸。默认值为(0.0, 0.0) 。

这是一个重载函数。

point startPosition()

返回网格图案的起始点。

另请参阅 ` setStartPosition()`。

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