- Qt 6.12
- Qt Canvas Painter
- QtCanvas2D
- gridpattern2d
- Qt Canvas Painter | Commercial or GPLv3

# gridpattern2d QML Value Type

Provides gridpattern2d type matching to QCanvasGridPattern. More...

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

This type is in technology preview and is subject to change.

## Methods

- color backgroundColor()
- size cellSize()
- real feather()
- color lineColor()
- real lineWidth()
- real rotation()
- void setBackgroundColor(color backgroundColor)
- void setCellSize(real width, real height)
- void setCellSize(size cellSize)
- void setFeather(real feather)
- void setLineColor(color lineColor)
- void setLineWidth(real width)
- void setRotation(real rotation)
- void setStartPosition(real x, real y)
- void setStartPosition(point start)
- point startPosition()

## Detailed Description

This value type is provided by the QtCanvas2D import.

See also QCanvasGridPattern.

## Method Documentation

### color backgroundColor()

Returns the pattern grid background color.

See also setBackgroundColor().

### size cellSize()

Returns the size of a single cell in grid pattern.

See also setCellSize().

### real feather()

Returns the pattern feather in pixels.

See also setFeather().

### color lineColor()

Returns the pattern grid line color.

See also setLineColor().

### real lineWidth()

Returns the width of a stroke line in grid pattern.

See also setLineWidth().

### real rotation()

Returns the pattern rotation in radians.

See also setRotation().

### void setBackgroundColor(color backgroundColor)

Sets the pattern grid background color to backgroundColor. The default value is black.

See also backgroundColor().

### void setCellSize(real width, real height)

Sets the size of a single cell in grid pattern to width, height. When width is `0`, the horizontal bars are not painted. When height is `0`, the vertical bars are not painted. The default value is `(10, 10)`.

See also cellSize().

### void setCellSize(size cellSize)

Sets the size of a single cell in grid pattern to cellSize. When width is `0`, the horizontal bars are not painted. When height is `0`, the vertical bars are not painted. The default value is `(10, 10)`.

This is an overloaded function.

### void setFeather(real feather)

Sets the pattern feather to feather in pixels. The default value is `1.0`, meaning a single pixel antialiasing.

See also feather().

### void setLineColor(color lineColor)

Sets the pattern grid line color to lineColor. The default value is white.

See also lineColor().

### void setLineWidth(real width)

Sets the width of a stroke line in grid pattern to width. The default value is `1.0`.

See also lineWidth().

### void setRotation(real rotation)

Sets the pattern rotation to rotation in radians. Rotation is done around the grid startPosition(). The default value is `0.0`, meaning the grid is not rotated.

See also rotation().

### void setStartPosition(real x, real y)

Sets the start point of grid pattern to (x, y). Start position means top-left corner of the grid in pattern. Pattern will then be extended to all positions from here. The default value is `(0.0, 0.0)`.

See also startPosition().

### void setStartPosition(point start)

Sets the start point of grid pattern to start. Start position means top-left corner of the grid in pattern. Pattern will then be extended to all positions from here. The default value is `(0.0, 0.0)`.

This is an overloaded function.

### point startPosition()

Returns the start point of grid pattern.

See also setStartPosition().