Class: QgsPropertyDefinition

Definition for a property.

QgsPropertyDefinition defines the type of values allowed for a property, and handles descriptive names and help text for using the property. Definitions can use one of the predefined standard templates to simplify definition of commonly used property types, such as colors and blend modes.

class qgis.core.QgsPropertyDefinition[source]

Bases: object

__init__()

Constructs an empty property.

__init__(name: str | None, description: str | None, type: QgsPropertyDefinition.StandardPropertyTemplate, origin: str | None = '', comment: str | None = '')

Constructor for QgsPropertyDefinition, using a standard property template.

Parameters:
  • name (Optional[str]) – is used internally and should be a unique, alphanumeric string.

  • description (Optional[str]) – can be any localised string describing what the property is used for.

  • type (QgsPropertyDefinition.StandardPropertyTemplate) – one of the predefined standard property template

  • origin (Optional[str] = '') – The origin of the property

  • comment (Optional[str] = '') – A free comment for the property

__init__(name: str | None, dataType: QgsPropertyDefinition.DataType, description: str | None, helpText: str | None, origin: str | None = '', comment: str | None = '')

Constructor for custom QgsPropertyDefinitions.

Parameters:
  • name (Optional[str]) – is used internally and should be a unique, alphanumeric string.

  • dataType (QgsPropertyDefinition.DataType) – the data type for the property

  • description (Optional[str]) – can be any localised string describing what the property is used for.

  • helpText (Optional[str]) – parameter should specify a descriptive string for users outlining the types of value acceptable by the property (eg ‘dashed’ or ‘solid’ for a line style property).

  • origin (Optional[str] = '') – The origin of the property

  • comment (Optional[str] = '') – A free comment for the property

__init__(a0: QgsPropertyDefinition)
Parameters:

a0 (QgsPropertyDefinition)

BlendMode = 14
Boolean = 0
CapStyle = 21
ColorNoAlpha = 12
ColorWithAlpha = 11
Custom = 3000
class DataType

Bases: int

DataTypeBoolean = 2
DataTypeNumeric = 1
DataTypeString = 0
DateTime = 26
Double = 4
Double0To1 = 6
DoublePositive = 5
FillStyle = 20
HorizontalAnchor = 22
Integer = 1
IntegerPositive = 2
IntegerPositiveGreaterZero = 3
LineStyle = 18
Offset = 25
Opacity = 9
PenJoinStyle = 13
Point = 15
RenderUnits = 10
Rotation = 7
Size = 16
Size2D = 17
class StandardPropertyTemplate

Bases: int

String = 8
StrokeWidth = 19
SvgPath = 24
VerticalAnchor = 23
comment(self) str[source]

Returns the comment of the property

Return type:

str

dataType(self) QgsPropertyDefinition.DataType[source]

Returns the allowable field/value data type for the property.

Return type:

QgsPropertyDefinition.DataType

description(self) str[source]

Descriptive name of the property.

Return type:

str

helpText(self) str[source]

Helper text for using the property, including a description of the valid values for the property.

Return type:

str

name(self) str[source]

Returns the name of the property. This is used internally and should be a unique, alphanumeric string.

Return type:

str

origin(self) str[source]

Returns the origin of the property. For example, a PAL property has an origin set to “labeling” while a diagram property has an origin set to “diagram”.

Return type:

str

setComment(self, comment: str | None)[source]

Sets comment of the property

Parameters:

comment (Optional[str])

setDataType(self, type: QgsPropertyDefinition.DataType)[source]

Sets the data type

Parameters:

type (QgsPropertyDefinition.DataType)

setName(self, name: str | None)[source]

Sets the name of the property

Parameters:

name (Optional[str])

setOrigin(self, origin: str | None)[source]

Sets the origin of the property. For example, a PAL property has an origin set to “labeling” while a diagram property has an origin set to “diagram”.

Parameters:

origin (Optional[str])

standardTemplate(self) QgsPropertyDefinition.StandardPropertyTemplate[source]

Returns the property’s standard template, if applicable. Non standard types will return the Custom template.

Return type:

QgsPropertyDefinition.StandardPropertyTemplate

supportsAssistant(self) bool[source]

Returns True if the property is of a type which is compatible with property override assistants.

Return type:

bool