Class GridConfig
Build from GridConfig.h
Krita 6.0.0

The GridConfig class encapsulates a Krita Guides configuration.

Methods

angleAspectLocked()bool angleLeft()float angleLeftActive()bool angleRight()float angleRightActive()bool cellSize()int cellSpacing()int colorMain()QColor colorSubdivision()QColor colorVertical()QColor fromXml(xmlContent: str)bool lineTypeMain()str lineTypeSubdivision()str lineTypeVertical()str offset()QPoint offsetAspectLocked()bool setAngleAspectLocked(angleAspectLocked: bool) setAngleLeft(angleLeft: float) setAngleLeftActive(active: bool) setAngleRight(angleRight: float) setAngleRightActive(active: bool) setCellSize(cellSize: int) setCellSpacing(cellSpacing: int) setColorMain(colorMain: QColor) setColorSubdivision(colorSubdivision: QColor) setColorVertical(colorVertical: QColor) setLineTypeMain(lineType: str) setLineTypeSubdivision(lineType: str) setLineTypeVertical(lineType: str) setOffset(offset: QPoint) setOffsetAspectLocked(offsetAspectLocked: bool) setSnap(snap: bool) setSpacing(spacing: QPoint) setSpacingActiveHorizontal(active: bool) setSpacingActiveVertical(active: bool) setSpacingAspectLocked(spacingAspectLocked: bool) setSubdivision(subdivision: int) setType(gridType: str) setVisible(visible: bool) snap()bool spacing()QPoint spacingActiveHorizontal()bool spacingActiveVertical()bool spacingAspectLocked()bool subdivision()int toXml()str type()str visible()bool

Member documentation

angleAspectLocked()bool
Krita 6.0.0

Returns status of "Aspect locked" property for angles values (mean, left and right angles values are linked to keep ratio) AngleAspectLocked value is used for grid type "isometric" and "isometric_legacy".

Return

If locked, return True.

angleLeft()float
Krita 6.0.0

Returns left angle (in degrees) of isometric grid for document. AngleLeft value is used for grid type "isometric".

Return

A positive decimal value, in range [0.00 - 89.00]

angleLeftActive()bool
Krita 6.0.0

Returns if left angle grid is active. Spacing value is used for grid type "isometric".

Return

a boolean which indicate if left angle grid is active or not

angleRight()float
Krita 6.0.0

Returns right angle (in degrees) of isometric grid for document. AngleRight value is used for grid type "isometric".

Return

A positive decimal value, in range [0.00 - 89.00]

angleRightActive()bool
Krita 6.0.0

Returns if right angle grid is active. Spacing value is used for grid type "isometric".

Return

a boolean which indicate if right angle grid is active or not

cellSize()int
Krita 6.0.0

Returns grid cell border size (in pixels) for document. Cell spacing value is used for grid type "isometric".

Return

A positive integer value, in range [10 - 1000]

cellSpacing()int
Krita 6.0.0

Returns grid cell spacing (in pixels) for document. Cell spacing value is used for grid type "isometric_legacy".

Return

A positive integer value, minimum value is 10

colorMain()QColor
Krita 6.0.0

Returns grid main line color

Return

The color for grid main line

colorSubdivision()QColor
Krita 6.0.0

Returns grid subdivision line color ColorSubdivision value is used for grid type "rectangular".

Return

The color for grid subdivision line

colorVertical()QColor
Krita 6.0.0

Returns grid vertical line color ColorSubdivision value is used for grid type "isometric".

Return

The color for grid vertical line

fromXml(xmlContent: str)bool
Krita 6.0.0

Load grid definition from an XML document

Parameters

xmlContent

xml content provided as a string

Return

True if xml content is valid and grid has been loaded, otherwise False

lineTypeMain()str
Krita 6.0.0

Returns grid main line type

Return

The main line type for grid in current document Can be: - "solid" - "dashed" - "dotted"

Krita 6.0.0

Returns grid subdivision line type

Return

The subdivision line type for grid in current document Can be: - "solid" - "dashed" - "dotted"

LineTypeSubdivision value is used for grid type "rectangular".

lineTypeVertical()str
Krita 6.0.0

Returns grid vertical line type

Return

The vertical line type for grid in current document Can be: - "solid" - "dashed" - "dotted" - "none"

LineTypeVertical value is used for grid type "isometric".

offset()QPoint
Krita 6.0.0

Returns grid offset (in pixels, from origin) for document.

Return

A QPoint that define X and Y offset.

offsetAspectLocked()bool
Krita 6.0.0

Returns status of "Aspect locked" property for offset values (X and Y values are linked to keep ratio)

Return

If locked, return True.

setAngleAspectLocked(angleAspectLocked: bool)
Krita 6.0.0

Set status of "Aspect locked" property for angles values (left and right angles values are linked to keep ratio) AngleAspectLocked value is used for grid type "isometric" and "isometric_legacy".

Parameters

angleAspectLocked

Set to True lock aspect.

setAngleLeft(angleLeft: float)
Krita 6.0.0

Set left angle (in degrees) of isometric grid for document. AngleLeft value is used for grid type "isometric".

Parameters

angleLeft

A positive decimal value, in range [0.00 - 89.00]

setAngleLeftActive(active: bool)
Krita 6.0.0

Set left angle grid active. Spacing value is used for grid type "isometric".

Parameters

active

True to activate left angle grid, False to deactivate it.

setAngleRight(angleRight: float)
Krita 6.0.0

Set right angle (in degrees) of isometric grid for document. AngleRight value is used for grid type "isometric".

Parameters

angleRight

A positive decimal value, in range [0.00 - 89.00]

setAngleRightActive(active: bool)
Krita 6.0.0

Set right angle grid active. Spacing value is used for grid type "isometric".

Parameters

active

True to activate right angle grid, False to deactivate it.

setCellSize(cellSize: int)
Krita 6.0.0

Set grid cell size (in pixels) for document. Cell spacing value is used for grid type "isometric".

Parameters

cellSize

An integer that define cell border size.

setCellSpacing(cellSpacing: int)
Krita 6.0.0

Set grid cell spacing for document. Cell spacing value is used for grid type "isometric_legacy".

Parameters

cellSpacing

A integer that define spacing, in range [10 - 1000]

setColorMain(colorMain: QColor)
Krita 6.0.0

Set grid main line color

Parameters

colorMain(no description provided)
setColorSubdivision(colorSubdivision: QColor)
Krita 6.0.0

Set grid subdivision line color ColorSubdivision value is used for grid type "rectangular".

Parameters

colorSubdivision(no description provided)
setColorVertical(colorVertical: QColor)
Krita 6.0.0

Set grid vertical line color ColorSubdivision value is used for grid type "isometric".

Parameters

colorVertical(no description provided)
setLineTypeMain(lineType: str)
Krita 6.0.0

Set grid main line type

Parameters

lineType

The main line type to apply for grid Can be: - "solid" - "dashed" - "dotted"

setLineTypeSubdivision(lineType: str)
Krita 6.0.0

Set grid subdivision line type

Parameters

lineType

The subdivision line type to apply for grid Can be: - "solid" - "dashed" - "dotted"

LineTypeSubdivision value is used for grid type "rectangular".

setLineTypeVertical(lineType: str)
Krita 6.0.0

Set grid vertical line type

Parameters

lineType

The vertical line type to apply for grid Can be: - "solid" - "dashed" - "dotted" - "none"

LineTypeVertical value is used for grid type "isometric".

setOffset(offset: QPoint)
Krita 6.0.0

Define grid offset (in pixels, from origin) for document.

Parameters

offset

A QPoint that define X and Y offset (X and Y in range [0 - 500])

setOffsetAspectLocked(offsetAspectLocked: bool)
Krita 6.0.0

Set status of "Aspect locked" property for offset values (X and Y values are linked to keep ratio)

Parameters

offsetAspectLocked

Set to True lock aspect.

setSnap(snap: bool)
Krita 6.0.0

Activate or deactivate snap to grid for document

Parameters

snap

Set to True to activate snap to grid.

setSpacing(spacing: QPoint)
Krita 6.0.0

Set grid spacing (in pixels) for document. Spacing value is used for grid type "rectangular".

Parameters

spacing

A QPoint that define X and Y spacing (minimum value for X and Y is 1)

Krita 6.0.0

Set horizontal grid spacing active. Spacing value is used for grid type "rectangular".

Parameters

active

True to activate horizontal spacing, False to deactivate it.

setSpacingActiveVertical(active: bool)
Krita 6.0.0

Set vertical grid spacing active. Spacing value is used for grid type "rectangular".

Parameters

active

True to activate vertical spacing, False to deactivate it.

setSpacingAspectLocked(spacingAspectLocked: bool)
Krita 6.0.0

Set status of "Aspect locked" property for spacing values (X and Y values are linked to keep ratio) SpacingAspectLocked value is used for grid type "rectangular".

Parameters

spacingAspectLocked

Set to True lock aspect.

setSubdivision(subdivision: int)
Krita 6.0.0

Set number of grid subdivision for document. Subdivision value is used for grid type "rectangular".

Parameters

subdivision

A positive integer value, in range [1 - 10]

setType(gridType: str)
Krita 6.0.0

Set current grid type applied for document.

Parameters

gridType

The grid type can be: - "rectangular" - "isometric" - "isometric_legacy"

setVisible(visible: bool)
Krita 6.0.0

Set grid visibility for document.

Parameters

visible(no description provided)
snap()bool
Krita 6.0.0

Returns snap to grid status for document.

Return

If snap to grid is active on document, return True.

spacing()QPoint
Krita 6.0.0

Returns grid spacing (in pixels) for document. Spacing value is used for grid type "rectangular".

Return

A QPoint that define X and Y spacing.

Krita 6.0.0

Returns if horizontal grid spacing is active. Spacing value is used for grid type "rectangular".

Return

a boolean which indicate if horizontal grid is active or not

Krita 6.0.0

Returns if vertical grid spacing is active. Spacing value is used for grid type "rectangular".

Return

a boolean which indicate if vertical grid is active or not

spacingAspectLocked()bool
Krita 6.0.0

Returns status of "Aspect locked" property for spacing values (mean, X and Y values are linked to keep ratio) SpacingAspectLocked value is used for grid type "rectangular".

Return

If locked, return True.

subdivision()int
Krita 6.0.0

Returns number of grid subdivision for document. Subdivision value is used for grid type "rectangular".

Return

A positive integer value, starting from 1

toXml()str
Krita 6.0.0

Save grid definition as an XML document

Return

A string with xml content

type()str
Krita 6.0.0

Returns current grid type applied for document.

Return

The grid type can be: - "rectangular" - "isometric" - "isometric_legacy"

visible()bool
Krita 6.0.0

Returns grid visibility for document.

Return

If grid is visible, return True.